Yes but i am implementing data driver framework with maven. For XSLT report:
- In order to implement ANT how i can give the jar file path?. Because I have configured it in .m2 repository.
reports ng has been depreacted you cannot make xslt reports from maven you have to use ANT.
if you are not using ANT and want to make good looking reports with maven use this
1. go to this link <http://relevantcodes.com/testng-listener-using-extentreports/>
2. create class "ExtentReporterNG". This is Listener class and put second block code in it from upper link and save it.
3. put ExtentReporterNG this listener in your testneg.xml. change package name with your package name.
<listeners>
<listener class-name="package.ExtentReporterNG" />
</listeners>
4. Add dependency in you POM.xml
<!-- Extent Reports -->
<dependency>
<groupId>com.relevantcodes</groupId>
<artifactId>extentreports</artifactId>
<version>2.04</version>
</dependency>
5. now open cmd prompt and go to your project location and run command "mvn compile" and after it run "mvn package"
6. go in eclipse and refresh your project and run your testng.xml
7. after running refresh your project and check report in test output folder.
8. a folder generate with your class name. check extent.html in it and open this in web browser.
I have this code and able to get the Extent Reports. But i feel XSLT report is better one.
ok, if you want make XSLT reports you have to use ant.
watch module 31 and let me know if you were successful.
I am able to get the report if i keep jar file in specific location. But i know as far we use maven in our framework it wont be a best practice
Hi Think Extent report is a great idea, i am currently using this in my maven project, it has everything in one place, logs, screenshot, system info, graphical report. and most important thing is: it is very easy to use.
Check this screenshot:
https://www.dropbox.com/s/818p4s53qjzwock/Screen%20Shot%202016-01-15%20at%2011.25.48%20AM.png?dl=0
@mizanur , I think i am using 2.5 version of extent report. And i am unable to get the screen shots if the test fails.
Please let me know if i need to change any code in ExtentReporterNg.java
Thanks
This works fine for me and i m using 2.031 version:
@AfterMethod
public void afterMethod(ITestResult result, Method caller) {
if(ITestResult.FAILURE==result.getStatus()){
String screenshotPath= Utility.shootWebElement(driver,element, result.getName());// this will capture screenshot and return the path of it
String image=logger.addScreenCapture(screenshotPath); // this and the next line will add screenshot to extentreport
logger.log(LogStatus.FAIL, "Title verification", image);
}
ComplexReportFactory.closeTest(caller.getName());
HI Can you pls provide the latest version of extent report and code for running in my framework.