
Before moving to actual post hats off to the developer who actually developed this jar for advanced reporting.
You must be wondering that why we need custom reporting because till now we have covered so many type of reporting like Default reporting by TestNG and XSLT report via ANT.
Version 2 is updated. Kindly use new version 2 for new features.
Before moving to this article lets see what exactly we will get.
Watch youtube video for the same

Advance Selenium Reporting
How to generate Advance Selenium Reporting
Check out the below article if you have not covered during previous post.
Default report in Selenium using TestNG
I loved this reporting which allows me generate log inside report and we can attach screenshot as well at run time and some other features as well.
Features of Extent Report
- Allow is to generate logs inside HTML.
- Generate PIE Chart based on test case status.
- Generate Step summary.
- We can filter reports depends on status.
- It provides execution history.
- It fetches system details like OS, Java Version, and Memory and so on.
- Allow us the attach screenshot in report that is most important feature.
Download
1- Open any browser
2-Navigate to below url and click on download link to get jar file which we have to add into our project to get Custom report.
url – http://extentreports.com/
After downloading you will get a zip file which you have to unzip. After unzipping you will get a jar file which we have to add into our project.
If you are new to eclipse and don’t know how to add jars then check below post which helps you to get familiar which Eclipse IDE
Program for Advance Selenium Reporting
Now we are done with configuration so let’s see how we can generate reports via extent report
package demo; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.testng.Assert; import org.testng.annotations.Test; import com.opera.core.systems.scope.services.Exec; import com.relevantcodes.extentreports.ExtentReports; import com.relevantcodes.extentreports.LogStatus; public class AdvanceReporting { @Test public void verifySeleniumBlog(){ // Create object of extent report and specify the Class name in get method // in my case I have used AdvanceReporting.class ExtentReports extent = ExtentReports.get(AdvanceReporting.class); // Call init method and specify the location where you want to save this report // second parameter is set to true it means it will overwrite report with new one extent.init("C:\\Mukesh\\Report\\myreport.html", true); // Start Test extent.startTest("Verify Page Title"); // Start browser WebDriver driver=new FirefoxDriver(); driver.manage().window().maximize(); extent.log(LogStatus.INFO, "Browser started"); // Open application driver.get("https://learn-automation.com"); extent.log(LogStatus.INFO, "Navigated to www.learn-automation.com"); // get title String title=driver.getTitle(); extent.log(LogStatus.INFO, "Get the current title"); // Verify title Assert.assertTrue(title.contains("Selenium")); extent.log(LogStatus.PASS, "Title verified"); // In case you want to attach screenshot then use below method // I am taking random image but you have to take screenshot at run time and specify the path extent.attachScreenshot("C:\\Mukesh\\image1.jpg"); // Close application driver.quit(); extent.log(LogStatus.INFO, "Browser closed"); // close report extent.endTest(); } }
After execution you can check report in path which you have mentioned in program.
Output/ Sample report
In above program you have to add code for screenshot which will be added in reports.
Check out the below post how we can capture screenshot and how to create reusable action to reuse code.
How to take screenhsot in Selenium
It is very good and fast plugin/jar so can not cover all in one shot so you can check documentation of as well and try to explore as much possible.
Link for documentation- http://relevantcodes.com/ExtentReports-documentation/
Soon I will be creating part 2 of above post.
If you like this post and if you feel its informative then please comment below and share with others as well.
Keep visiting, have a nice day 🙂
For More updates Learn Automation page
For any query join Selenium group- Selenium Group
Hi Mukesh,
How to use extent report in POM? Can you please explain with multiple classes?
Hi Archana,
In Page Object Model, it is always better if you implement Extent Reporting with TestNG Listener. Use ITestListener interface for this purpose.
Hi ,
http://extentreports.relevantcodes.com/ This URL is not working how to download JAR file.
Hi Komal,
This is latest extent report link http://extentreports.com/
From this link, download from jar links https://mvnrepository.com/artifact/com.aventstack/extentreports/3.1.5
Hi Mukesh can you tell me how to use this extent report using junit?
Hi Trisha,
Just like annotations of TestNG, you can use JUnit annotations as per your test script requirement. I would recommend you to use TestNG because it is more advanced than JUnit
Hi Mukesh,
I am using extent report on an advanced level by attaching screenshots. But now I have to test in multiple browsers and like to report in extent reports only. Is there any way to represent extent report in multiple browsers result like TestNg report.
Hi Prathyusha,
Are you running tests in parallel if so then you have to use ThreadLocal class to wrap ExtentTest object so that each ExtentTest object remains thread safe.
Hi Mukesh,
I have tried the above code and I am getting Access Denied for the location where I want to store the report.
I have tried various drives but I am stuck on Same Access Denied issue. Can you please help
Hi Sandeep,
Try to save screenshot in logged in user folder
when i open cmd
and enter
ant -version
the command prompt shows this massge
“java.exe “”is not recognized as an internal or external command operabke program or batch file”
Hi Dawood,
You dont need ANT to run this report you can configure extent report and use it. To run ANT or MAVEN you need to set Java path as well.
Hi Mukesh, I had a quey that I have been asked to log the logs in text as well and i am using extent reports which has default logging feature… pls suggest views on it
Hi there,
It all depends on your project requirements whether you need logs from log4j or putting logs into extent report. Extent report is for showing report to client in a contemporary way while logs in text file is primitive.
Hi mukesh,
I have downloaded 2.41.2 version and i am getting error on get method(The method get(Class) is undefined for the type
Please give suggestion. Thanks
Hi Prashant,
It is better if you use latest version of Selenium Webdriver, at least 2.53.0
Hi mukesh,
I have downloaded 2.41.2 version and i am getting error on get method(The method get(Class) is undefined for the type
Please give suggestion. Thanks
Hi,
Please refer part 2 for new syntax
Hi Mukesh,
Hope you doing well
I am using extent report and printing the content for Finnish language. The data is getting replaced with blocked characters rather printing the actual value, In short I guess extent report is not supporting the char set.
Could you please help with this issue.
Thanks
Kapil Kapoor
Hi Kapil,
This one I am not sure may be you can check with Anshu arora who developed extent report.
Hi Mukesh,
I am getting broken UI for the HTML report.
Can you please suggest how that can be fixed.
Hi Deb,
Kindly try version 2
I have tried version 2.40.2 and 2.05, the issue persists for both. Is there something else that I am missing.
try with 2.41
I did same as per your steps but i am not getting the report format and it is showing simple report format,I think you are hiding some code to generate in this format.Please help how to generate this particular format report in extent
Rajesh, you have to follow part 2 not this post.
Kindly refer below post and mention error also if any.
http://learn-automation.com/advance-selenium-reporting-with-screenshots-2/
Hi Your code is not working because there is no get method in ExtentReport’s provide complete proper explanation,most of the sites are providing half of the information and we are unable to get addscreenshot method in extent .
Hi Rajesh,
I guess you have not gone through complete article. I have mentioned that version 2 is available so you can refer new version
http://learn-automation.com/advance-selenium-reporting-with-screenshots-2/
Kindly go throw it and let me know if any issue.
Hi Mukesh
I put my screenshots in the shared folder but my other colleagues still cannot view the screenshots.
Please advise.
Hi Omphile,
Can you see screenshot in report in your local machine?
Hi Mukesh, your tutorials are really great help
Just a question, when will we use XSLT Reporting over Extent Reporting (or vice versa)? Is there a huge advantage to use the one over the other? I am new to this topic about automation reporting. Should I implement both on my project? Thanks ahead Mukesh
Hi Moreno,
You can use any one of it. I use extent report because It allows me to add screenshots as well.
Hi, very great job. I have just one questions – do you have any option to combine several reports / iterations into one report. Not overwrite, but contine
Yes Vadim, you can use EXTENT X report for this. I have not tried yet but it is possible.
Hi Mukesh I have created the object of Extentreports extent. But I am getting error when I try to execute ExtentReports.get(Completeflow.class). It is showing error on get method and saying the method get is undefined for the ExtentReports.
Hey Abhinav,
Kindly refer new doc
http://learn-automation.com/advance-selenium-reporting-with-screenshots-2/
Hi Mukesh
Now it is working fine
Thanks for the help.
Great Abhinav
Hi Mukesh,
I am writing my logs to a text log file. Is there a way to read it and convert into HTML report.
Hi Harmeet,
In extent report all logs by default is coming in HTML format. You can use latest version of extent report.
Here is the link http://learn-automation.com/advance-selenium-reporting-with-screenshots-2/
hello…can we use this extnd report for testNG?????
Hey Minnu,
Yes we can use this with TestNG.
hello sir,
i want 2 know this extnt reporter wil work only in maven or testng also??can u reply
Yes will work with Maven and TestNG too.
hello,,i installed Extent Report .but it shows error.For get the idea of this,,am using ur sample pgms and jars……it showing “Error: Could not find or load main class com.selenium.test.Reportlog
“.in sample pgm…error in the ” ExtentReports extent = ExtentReports.get(AdvanceReporting.class);”
” extent.log(LogStatus.INFO, “Browser started”);”
” extent.log(LogStatus.INFO, “Navigated to http://www.learn-automation.com“);”
Hi Minnu,
You have to use version 2 now.
http://learn-automation.com/advance-selenium-reporting-with-screenshots-2/
Hi mukesh,
I am taking screenshot on failure of the step, but in report the screenshots are not visible
only a small image icon is coming . Even after clicking on the image , nothing is visible.
Is there is any setting I need to do before execution.
Hi Praveen,
Check image path
Hi mukesh,
I am taking screenshot on failure of the step, but in report the screenshots are not visible
only a small image icon is coming . Even after clicking on the image , nothing is visible.
Hey Praveen,
Kindly check screenshot path if path is invalid then you get cross mark instead of image.
Hi Mukesh,
I have downloaded the latest version 2.41.1 and same i have added in referenced libraries (extentreports-java-2.41.1) , now when i am writing first line to extent reports then it’s showing error in get method and after mouse howering it’s displaying error like the method get(class ) is undefined for the type ExtentReports
ExtentReports extent = ExtentReports.get(verifyselReport.class);
WebDriver driver= new FirefoxDriver();
Please revert on this.
Thanks & Regards,
Paramjeet
Hey Paramjeet,
Kindly refer below post for 2.41 http://learn-automation.com/advance-selenium-reporting-with-screenshots-2/
Hi Mukesh,
How can we email Extent Reports daily automatically after test case execution completes?Can please share the code?
Hi Rupali,
In this case you need to write email code and this code you can run once your execution is done.
Hi Mukesh,
I am saving extent reports in my local machine at location C:\\ReportsExtent\\ReportsExtent.html. Is it possible to send this html report in email or do I need to convert it to pdf or any other format?
Also is it possible that extent report is emailed in proper format with error screenshot through jenkins after every build is run. If you share any post regarding sending customized reports via jenkins then it would be of great help.
Hi Rupali,
First Answer- Yes you can send email with report kindly check below post.
http://www.assertselenium.com/java/emailable-reports-for-selenium-scripts/
Second- In jenkins you can add plugin which will help you to send custom email.
Plugin- Email-ext plugin
http://www.nailedtothex.org/roller/kyle/entry/articles-jenkins-email
Hi Mukesh,
Thanks for this tutorial.
I have couple of questions –
1- Do we need to configure extent report in every testng class ?
2- When I am using [ logger.init(“D:\\Extent.html”, true); ] in individual testNG class, then only latest testcase is getting record in extent report, please suggest how we can capture all the cases (@Test) in extent report.
Thanks,
Hi Shobhit,
Answer
1- yes or else you can use listener to do this.
2- Kindly refer version 2 since version 1 is deprecated now.
Hi
Mukesh
I want to used Extent report in my framework .I work on Hybridframework .
I add the extent report in test Configuration Package class where launching of browser ,loading of url are take place but it not work it so null pointer exception in precondition browser is launching but url is not loading how to solve it.And also suggest me how to i add generic function for Extent report in my framework that work for every test scripts run.
Hi Pankaj,
Kindly refer new article http://learn-automation.com/advance-selenium-reporting-with-screenshots-2/
Hi ,
I want to know how to pass screen shot path dynamically after taking screen shots in this code
extent.attachScreenshot(“C:\\Mukesh\\image1.jpg”);
please provide the code i want it should be dynamic.
.
Hi Rajesh,
Kindly refer my screenshot video and advanced refer part 2. I have covered the same.
Hi Mukesh,
I am using extent reports 2. I am able to attach screenshots in the report. But when I share the report to others they are not able to see the screenshots in the report. How to resolve this issue.
Hi Keerthi,
Keep screenshots in shared folder.
Hi Mukesh,
HatsOff to your effort for creating of nice posts which are usefull for beginners and who are willing to move there carrier to forward.
currently i am working with jenkins and i would like to generate reports using extent reports plugin. Like to see with screenshots in jenkins Dashboard (or) from new tab.could you please guide me the configuration ? Or else ,,If you create a post on this, it would be more benefit for the users who are following in this site.
Thanks in Advance
pavan kumar D
sure will try to upload post on the same.
HI Mukesh,
The latest report will generate report at hte end of the execution by calling flush method.But incase my execution stops halfway due to error what happens to the report then.Can you suggest me the way to generate.I believe 1.41 version report generates the very first step we call it.
Thanks,
Kumar
Hi KUmar,
Kindly refer http://learn-automation.com/advance-selenium-reporting-with-screenshots-2/
driver.get(“http://www.google.com”);
extent.log(LogStatus.INFO, “Navigated to Google”);
String title=driver.getTitle();
Assert.assertTrue(title.contains(“Selenium”));
extent.log(LogStatus.PASS, “Title verified”);
If status is Fail. the execute will just stop here and not updated the LogStatus to Fail. How can I set if True log Pass, else log Fail?
Thanks
Hi Cannes,
you have to use try catch in this case.
I want to get a report for all my test cases together , currently I am getting it for that single test case , How can i get it for all 40 my test cases , Please guide
Hi Gaurav,
Please follow below link for the same.
http://extentreports.relevantcodes.com/java/version2/docs.html#parallel-classes
I am struggling to add reports in jenkins
Could you please share the steps here.
Hi vasudeo,
We have TestNG plugin in Jenkins which will generate report with Dashborad. PLease check and try the same
Hi Mukhes,
first of all thank you so much for your TestNG tutorial. I have learnt so much from that. 😉
Anyway, I’m still a newbie and I have a question regarding the “ExtentReports”, please.
As described about in your tutorial I have downloaded the JAR package “extentreports-2.40.0” and add all the JAR files into my ECLIPSE environment.
Then I copy the CODE from your example (Program for Advance Selenium Reporting) listed above, but somehow I got some issues.
Eclipse said that … “The method get(Class) is undefined for the type ExtentReports”
ExtentReports extent = ExtentReports.get(TestNGExample.class);
Eclipse said that … “The method init(String, boolean) is undefined for the type ExtentReports”
extent.init(“C:\\MYARCHIVES\\myreport.html”, true);
Eclipse said that … “The method log(LogStatus, String) is undefined for the type ExtentReports”
extent.log(LogStatus.INFO, “Browser started”);
etc.
It seems that “extent” is unknown due to this issue at the first line
Eclipse said that … “The method get(Class) is undefined for the type ExtentReports”
ExtentReports extent = ExtentReports.get(TestNGExample.class);
Could you help, please? Because I really like to run this report.
Thank you very much in advance.
Cheers
Loren
Hi Loren,
Thanks for nice comment.
is this issue solved?
Hi Mukesh,
Even i am facing the same issue.
ExtentReports extent = ExtentReports.get(Reporting.class);
The method get(Class) is undefined for the type ExtentReports
Regards,
Giridhar B S
Hi Grirdhar,
Please use the latest version 2 which will resolve your issue.
Hi Mukesh,
I have downloaded jar file version ExtentReports Java 2.40 (6044) and i have added to my project successfully.
when i add this line “ExtentReports extent = ExtentReports.get(DocsHomePage.class);” i get error for .get method and i have imported all the things below:
import com.opera.core.systems.scope.services.Exec;
import com.relevantcodes.extentreports.ExtentReports;
import com.relevantcodes.extentreports.LogStatus;
Can you please tell me how to get rid of this error saying “The method get(Class) is undefined for the type ExtentReports”
Hi Rakesh,
You are using extent report version 1 code.
Please use version 2 code
while using this ExtentReports extent = ExtentReports.get(XSLTReport.class);
i am getting compile time error on get method.please suggest
Use version 2 new jars.
Hi mukesh, Even after using the latest version of Extentreport ,i am facing the problem when i add this line “ExtentReports extent = ExtentReports.get(Demomaven.class);” i get error for .get method and also for init method.
can you please tell how to come out of this problem?
Hi Dheemanth,
Please follow download steps carefully and run again.
http://learn-automation.com/advance-selenium-reporting-with-screenshots-2/
Ahh i think i figured it out, i have to init the report as a db report and it seems to work…. awesome!
Great Aaron Cheers 🙂
Hi Mukesh,
I love the Extent Reports and I just recently implemented the Extent Merge. However i see that extent merge is not including the screenshots from the merged reports. Is this something that has not been included yet in Extent merge? I noticed the ExtentMerge report doesn’t even reference the screenshot but only a blank td as seen below…
17:47:26
Thank you.
Hi Aaron,
Even I have implemented version 2 in my previous project and My manager loved it 🙂
Hi Mukesh, i tried the above example of verifying the blog title.
I get the below error when i run it.
Dec 31, 2015 12:06:15 PM com.relevantcodes.extentreports.Configuration
INFO: Configurating report from file:/D:/Selenium/extentreports-2.40.0/extentreports-java-2.40.0.jar!/com/relevantcodes/extentreports/resources/extent-config.xml
FAILED CONFIGURATION: @AfterMethod tearDown([TestResult name=VerifyBlogTitle status=FAILURE method=VerifyTitle.VerifyBlogTitle()[pri:0, instance:selenium.mukesh.extentreport.VerifyTitle@740cae06] output={null}])
java.lang.NullPointerException
at selenium.mukesh.extentreport.VerifyTitle.tearDown(VerifyTitle.java:47)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:564)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:786)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
at org.testng.TestRunner.privateRun(TestRunner.java:767)
at org.testng.TestRunner.run(TestRunner.java:617)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
at org.testng.SuiteRunner.run(SuiteRunner.java:240)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
at org.testng.TestNG.run(TestNG.java:1057)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)
Hi Guru,
There is some issue with current version of jars.
PLease download below zip file and extract file then add all jars and add into project.
http://relevantcodes.com/wp-content/plugins/download-monitor/download.php?id=17
Run the test again and let me know if you still facing the same issue.
But When I was added in test.log(LogStatus.ERROR() ) this method said that this logs are not associate with any class so how do I do this please let me know.
Hi Rohit please use version 2 then this issue wont come.
Hi Mukesh,
I am following your blog, your explanation is very good. Recently i have seen one video related to extentreport, there you have shown with only one test(@Test). I am little confusion to write for 2 or more @test blocks in same class.
If i want to execute two different classes, each class has more than 2 @Test blocks. So can you share the code how to implement for this type of scenarios.
Hi Manohar,
Thanks 🙂 Please find the below link which will help you out.
http://extentreports.relevantcodes.com/java/version2/docs.html#parallel-classes
Try this and let me know if any issue.
Happy weekend
Hello MukeshJi,
Could you please tell me how do I attach Log4j logs to the Extent Report Logs?
all my Scripts having different classes like for Element locators , for logs , for test scripts and other utilities as well.
Please suggest me what to do fro this.
Awaiting………………
Hi Rohit,
Actually,extent report internally use Log4j so i will recommend to add logs into reports only.
Hope its clear.
Hi Mukesh,
I have one doute, I m using page object model and input data reading excel all methods cal to main class(for ex we have 20 methods in different classes those methods cal to main class to End to End testing) how to implement extent reports.(if u any code please send me my email).
Hi Suresh,
I can guide you how you can achieve this.
Use @BeforeTest and keep initialise part into it and inside @Test use logger of extent test.
Hi,
How we can create a report of multiple test script beucause when we use report.init(“./target/AdvanceReport.html”, true); it is overrting previous test report and and shown only 1 test case result. is there any way to get result of all test cases run in single ran session. also rather thatn writing the path for report.init() in every test case can we write in single and it will generate the report of all scripts which we had ran.
Thanks,
Sachin
Hi Sachin,
In init method if you set to false it will not overrite your report but in that case you need to create unique report name(using time stamp).
Extent merge will help you check the doc http://extentreports.relevantcodes.com/extentmerge/docs.html
Report looks so nice. I have a query, i want to change the report name and other default values. How do i do that?
Hi Sneha,
You can customized full report based on your need. Please check below documentation for Version 2
http://extentreports.relevantcodes.com/java/version2/docs.html#assign-category
Hi Mukesh,
How to generate extent reports in page object model or any framework (we can cal the methods in main class)
Hi Suresh,
Generating report in POM will remain same.Please try to implement and let me know if you are finding any issue.
when i use 2.10 extent jar the report shows like only 2 tabs in the menu if i add category (smoke) then seeing 3 tabs under menu section………
— is there any possibility to add an image of Project with small icon at top right or left
— is there any way to hide the default host name and java version on Pie Chart below thing.
— is Jenkins support this report or any reports are there which supports for jenkins.
Hi Sateesh,
Please find my comment below.
1-is there any possibility to add an image of Project with small icon at top right or left?
Ans-Yes you can customize this please check below link
http://extentreports.relevantcodes.com/java/version2/docs.html
2-is there any way to hide the default host name and java version on Pie Chart below thing?
Ans- You can change host name and java version detected automatically.
3-is Jenkins support this report or any reports are there which supports for jenkins?
Ans- Yes jenkins support this report. 🙂
Thanks
Mukesh
while writing this ExtentReports extent = ExtentReports.get(AdvanceReporting.class);
i am getting error for get method as its undefined.
Kindly look at this.
Hi,
Here is the link for new version
Hi for me still it is showing old site not showing same as above new design site.
Check new link of extent report http://extentreports.relevantcodes.com/
Article link learn-automation.com/advance-selenium-reporting-with-screenshots-2/