Extent report test is marked as failed when it's node test has been retried

1.6k Views Asked by At

I have a test automation project that uses: Java, Maven, TestNG, Selenium WebDriver and Extent Reports (5.0.9 latest).

Most of my tests are using DataProviders and I also have RetryAnalyzer implemented - test/test case is retried once if it has failed.

My Extent Reports "design" looks like this: a method annotated with @Test is represented by ExtentTest extentTest = extentReports.createTest([...]. Each case from that method's data provider is represented by a node: extentNode = extentTest.createNode([...].

The result of that structure is this:

enter image description here

Sample Test has a data provider with 3 cases. Each case is represented by a node that is listed on the right. A node can be expanded to see steps, logs etc..

The problem that I am having is with scenario like this: one of the data provider cases fail and is retried. The retry run of that case passes.

After the initial run of a case is failed, extentTest status is set to Fail automatically because I do extentNode.fail([...] on exception in test method. In @AfterMethod method I remove initially failed node from the report: extentReports.removeTest(extentNode) but that doesn't change the status of extentTest - it's status is still returning Fail.

The result of that issue is this: enter image description here

Sample Test is listed as failed but each node is passed.

I tried extentTest.pass("description") - it just adds a passed step to a test but does not change the overall test status.

0

There are 0 best solutions below