Does agent-java-testNG report only failed test cases?
amsachin opened this issue · 2 comments
Hello,
I was able to integrate testNG with Reportportal. Steps followed:
- Added dependencies
<dependency>
<groupId>com.epam.reportportal</groupId>
<artifactId>agent-java-testng</artifactId>
<version>5.1.2</version>
</dependency>
<dependency>
<groupId>com.epam.reportportal</groupId>
<artifactId>logger-java-log4j</artifactId>
<version>5.1.4</version>
</dependency>
- Added following properties to maven-surefire-plugin
<properties>
<property>
<name>usedefaultlisteners</name>
<value>false</value>
</property>
<property>
<name>listener</name>
<value>com.epam.reportportal.testng.ReportPortalTestNGListener</value>
</property>
</properties>
- Added the listener in the testNG.xml suite file
<listeners>
<listener class-name="com.epam.reportportal.testng.ReportPortalTestNGListener" />
</listeners>
- Added reportportal.properties to src/main/resources/ folder
Question: On executing the test cases, the runs are getting displayed in the Launches only if the execution fails. If the execution passes, there is no record in the Launches.
I looked in com.epam.reportportal.testng.BaseTestNGListener
, it looks like testNGService.sendReportPortalMsg(testResult);
is present only in onTestFailure() and onConfigurationFailure() events. Is this by design for testNG? I have cucumber only project, with that project, report portal shows both passed and failed runs.
Please share the steps to display the passed runs also in the ReportPortal
@amsachin please double-check your code, you must be doing something wrong. TestNG is the most popular agent it has thousands of executions daily. You can easly check that your statement incorrect just by running mvn test
inside this folder: https://github.com/reportportal/examples-java/tree/master/example-testng-logback
testNGService.sendReportPortalMsg(testResult);
is only for error logging.
@HardNorth thank you for the quick response. My TestNG API test suite uses one of the run time param called RP_API_KEY and that was conflicting with the report portal's env param. In my case, RP stands for relying party. With help of Charles proxy figured that 401 error was occurring whenever http://localhost:8080/api/v1/ProjectName/launch
request was called.
Changing the RP_API_KEY variable name in my test suite, solved the issue i.e. all the runs are getting posted in Report Portal now.
ReportPortal is amazing, thanks a ton for you and your team for all the hard work!