Html Report | Selenium Forum
M
Posted on 10/01/2016
Hi Team,

I am working on data driver framework Module20.

Do we have any tutorial for Html report generation.

Thanks
Manoj

M
Replied on 10/01/2016

you can create xslt reports with ANT it is explained in the videos.


M
Replied on 12/01/2016

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.


M
Replied on 12/01/2016

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.


M
Replied on 13/01/2016

I have this code and able to get the Extent Reports. But i feel XSLT report is better one.


M
Replied on 13/01/2016

ok, if you want make XSLT reports you have to use ant.

watch module 31 and let me know if you were successful.


M
Replied on 15/01/2016

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


M
Replied on 15/01/2016

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


M
Replied on 15/01/2016

hi toolslearning,

try adding saxon and saxon-liaison dependency to maven.


M
Replied on 16/01/2016

@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


M
Replied on 17/01/2016

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());


M
Replied on 18/01/2016

HI Can you pls provide the latest version of extent report and code for running in my framework.


M
Replied on 18/01/2016

use these 2 project