Closed sunilpatro1985 closed 7 years ago
I think what may be missing is a call to append html reporters to each other as they run. See feature #668 and 3.0.1 documentation for setAppendExisting.
Yeah I tried this setAppendExisting() in 3.0.1, but was thinking if we could do the same for 3.0, if we can share extent object across different testng classes, but no idea if we can do this or not.
Hm... You have a good point; I only recently picked this tool up as of 3.0.1 (not 3.0 as you did mention in your OP). I'll share what I know in the hopes that it might be relevant to 3.0, but I am no expert in the feature set of 3.0 vs 3.0.1.
I can verify that we can do this in 3.0.1 (I use this maven dependency tag)
<dependency>
<groupId>com.relevantcodes</groupId>
<artifactId>extentreports</artifactId>
<version>3.0.1</version>
</dependency>
I have a single report appending throughout a single suite running multiple suites running multiple tests running multiple classes and they all append to a single (fairly large) report. This can be run over and over again and they ALL get appended for days on end. I have it set up in my testng annotation '@BeforeClass' like this:
@BeforeClass
public synchronized void classSetup){
extentHtmlReportFile = "../extentReport/extentHtmlReportFile.html";
htmlReporter = new ExtentHtmlReporter(extentHtmlReportFile);
htmlReporter.loadXMLConfig("./extentConfig.xml");
//append test report is TRUE; this maintains a history
htmlReporter.setAppendExisting(true);
extent = new ExtentReports();
extent.attachReporter(htmlReporter);
}
}
I hope this helps! Good luck~
Everytime you are calling GetExtent
, a new instance is returned. This isn't a good way of working on a "single" report. Instead, you need to create the instance once and utilize it for all your classes:
private static ExtentReports extent;
public static synchronized ExtentReports GetExtent() {
if (extent != null) return extent;
extent = new ExtentReports();
...
}
Extent report version - 3.0 Language - Java and TestNG classes
I have a class - ExtentManager.java
and 2 testNG classes as follows
TC1.java
TC2.java
testNG.xml
Result only shows for TC2.java, how can I get result for both TC1.java and TC2.java [refer screenshot]