extentreports-java
extentreports-java copied to clipboard
Extent report got somethings wrong when a same test runs twice
Summary
I realized that if I create more than 2 layers (2 nodes) in a test, the first generated report is fine. But if I run the test second time and use setAppendExisting, the previous build report got something attached on it.
Here is the first run
Here is the second run of the same test
and here is the previous report after the second run
As you can see, there are few issues:
- The previous build report got something appended on it, which can cause this report meaningless. Also, it will keep appending something new on all the previous build reports if I run the same test again. (It seems find for 2 or less than 2 layers tests)
- The number of the tests passed. I only have 2 tests but it displayed 3 tests passed.
- The description on the previous report have disappeared. Only shows on the newest build report.
Sample
import com.aventstack.extentreports.ExtentReports;
import com.aventstack.extentreports.ExtentTest;
import com.aventstack.extentreports.reporter.ExtentHtmlReporter;
public class TestClass {
public static void main(String[] args) {
String nodeName[] = {"ParentTest","FirstChildTest","SecChildNode","AnotherTest","more","lastOne"};
String nodeDescription[] = {"A", "B", "C", "D", "E", "F"};
ExtentHtmlReporter htmlReporter = new ExtentHtmlReporter("C:\\STMExtentReport.html");
htmlReporter.setAppendExisting(true);
ExtentReports extent = new ExtentReports();
extent.attachReporter(htmlReporter);
ExtentTest scenario = extent.createTest("Scenario - Name");
ExtentTest parentNode = scenario.createNode(nodeName[0], nodeDescription[0]);
parentNode.pass("Parent-Test-Info");
parentNode.pass("Parent-Test-Info1");
ExtentTest firstChildNode = parentNode.createNode(nodeName[1], nodeDescription[1]);
firstChildNode.pass("First-Child-Test");
firstChildNode.pass("First-Child-Test1");
ExtentTest SecChildNode = firstChildNode.createNode(nodeName[2], nodeDescription[2]);
SecChildNode.pass("Sec-Child-Test");
extent.flush();
Environment Details
- Extent report Version used: 3.1.2
- Operating System and version: Win 10
- JDK Version: 1.8.0_151
Anshooarora,
Using this feature much, requesting you for the fix as soon as you can. This is blocking me in reporting module.
Thanks