anshooarora / extentreports-java

Community version of Extent API for Java has moved to https://github.com/extent-framework/
http://extentreports.com
Other
529 stars 318 forks source link

#837 is seen in 3.0.6 as well. All categories are not shown when htmlReporter.setAppendExisting(true) #877

Open anilchander1 opened 7 years ago

anilchander1 commented 7 years ago

Summary

While running mutliple testng suite xml files via master testsuite & setAppendExisting(true) , the categories are shown only for the last testsuite.However for individual test cases categories are shown properly. Also 3.0.6 version is shown as 3.0.5

Expected Behavior

  1. Even after appending all categories should be shown in dashboard and category view.
  2. Version in dashboard should 3.0.6

Current Behavior

  1. After appending , last category only shown in dashboard and category view.
  2. Version in dashboard is 3.0.5

Sample

Master xml
--------------
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="master">
  <suite-files>
  <listeners>
            <listener class-name="BaseTestListener" /> <!-- This implements ITestListener-->
  </listeners>
    <suite-file path="testsuite1.xml" />
    <suite-file path="testsuite2.xml" />
  </suite-files>
</suite>

testsuite1.xml
-----------------
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="suite1">
    <test name="suite11">
        <!--<listeners>
            <listener class-name="BaseTestListener" />
        </listeners>-->
        <parameter name="Category" value="KimUnJong1"></parameter>
        <classes>
            <class name="TestNGTest1" />
            <class name="TestNGTest2" />
        </classes>
    </test>

</suite>
 Next suite is also similar with category "KimUnJong"

Inside Listener
------------------
 @Override
    public void onTestStart(ITestResult itr) {
//        System.out.println(classes.toString());
        if (!classes.contains(itr.getTestClass().getName())) {
            test = extent.createTest(itr.getTestClass().getName());
            test.assignCategory(itr.getMethod().getXmlTest().getParameter("Category"));
            classes.add(itr.getTestClass().getName());
        }
    }
@Override
    public void onStart(ISuite isuite) {
       ---some code
        htmlReporter.setAppendExisting(true);
        extent = new ExtentReports();
        extent.attachReporter(htmlReporter);
        --some code
    }

Environment Details

Screenshots

image image image image

No error while running the tests...

anilchander1 commented 7 years ago

Same issue found with authors as well...