You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wan to know if we have any method to show the latest result first in Extent report as earlier we had DisplayOrder.NewestFirst. In 4.x do we have alternative?
I am facing some issues while integrating with Retry analyzer with Extent Report.
Retry Analyzer:
@Override
public boolean retry(ITestResult iTestResult) {
if (!iTestResult.isSuccess()) {
if (count < maxTry) {
count++;
iTestResult.setStatus(ITestResult.FAILURE);
return true; // Tells TestNG to re-run the test
}
} else {
iTestResult.setStatus(ITestResult.SUCCESS); // If test passes, TestNG marks it as passed
}
return false;
}
In the Listener I have configured as follows:
public synchronized void onFinish(ITestContext context) {
Iterator<ITestResult> failedTestCases =context.getFailedTests().getAllResults().iterator();
Set<ITestResult> skippedTests = context.getSkippedTests().getAllResults();
while (failedTestCases.hasNext()) {
System.out.println("failedTestCases");
ITestResult failedTestCase = failedTestCases.next();
ITestNGMethod method = failedTestCase.getMethod();
if (context.getFailedTests().getResults(method).size() > 1) {
System.out.println("failed test case remove as dup:" + failedTestCase.getTestClass().toString());
failedTestCases.remove();
ExtentService.getInstance().removeTest(ExtentTestManager.getTest());
} else {
if (context.getPassedTests().getResults(method).size() > 0) {
System.out.println("failed test case remove as pass retry:" + failedTestCase.getTestClass().toString());
failedTestCases.remove();
ExtentService.getInstance().removeTest(ExtentTestManager.getTest());
}
}
}
for (ITestResult temp : skippedTests) {
skippedTests.remove(temp);
ExtentService.getInstance().removeTest(ExtentTestManager.getTest(temp));
}
ExtentService.getInstance().flush();
}
Scenario:
In a given suite I have 3 test cases and I have set max retry =2
test case 1 passed
test case 2 failed (Retried 2 times)
test case 3 failed (Retried 2 times)
In the testng report I am getting the expected result i.e. 1 passed and 2 failed and total 3 test cases but in the Extent Report it is showing 1 passed, 2 skipped and 2 failed. If we calculate total test cases it's showing 5 in the extent report. I want to delete all the skipped test cases from the report. How to do that?
Hi Anshoo ,
I wan to know if we have any method to show the latest result first in Extent report as earlier we had DisplayOrder.NewestFirst. In 4.x do we have alternative?
I am facing some issues while integrating with Retry analyzer with Extent Report.
Retry Analyzer:
In the Listener I have configured as follows:
Scenario:
In a given suite I have 3 test cases and I have set max retry =2
In the testng report I am getting the expected result i.e. 1 passed and 2 failed and total 3 test cases but in the Extent Report it is showing 1 passed, 2 skipped and 2 failed. If we calculate total test cases it's showing 5 in the extent report. I want to delete all the skipped test cases from the report. How to do that?
Can you please help?
@anshooarora
The text was updated successfully, but these errors were encountered: