• Skip to main content
  • Skip to primary sidebar
  • Skip to footer
  • Home
  • Programming Languages
    • Java Tutorials
    • Python Tutorials
    • JavaScript Tutorials
  • Automation Tools and Different Tools
    • Web Automation
      • Selenium with Java
        • Selenium Basic
        • Selenium Advance
        • Selenium Realtime
        • Framework
        • Selenium Interview
        • Selenium Videos
        • Selenium with Docker
      • Selenium with Python
      • WebdriverIO
        • Selenium Webdriver C# Tutorial
      • Cypress
      • Playwright
    • TestNG
    • Cucumber
    • Mobile Automation
      • Appium
    • API Testing
      • Postman
      • Rest Assured
      • SOAPUI
    • testRigor
    • Katalon
    • TestProject
    • Serenity BDD
    • Gradle- Build Tool
    • RPA-UiPath
    • Protractor
    • Windows Automation
  • Automation For Manual Testers
  • Services
  • Online Training
  • Contact us
  • About me
  • Follow us
    • Linkedin
    • Facebook Group
    • Facebook Page
    • Instagram

Automation

Selenium WebDriver tutorial Step by Step

You are here: Home / Basic Selenium / Advance Selenium Reporting with Screenshots Part 2

Advance Selenium Reporting with Screenshots Part 2

April 14, 2020 by Mukesh Otwani 142 Comments

Download_Extent_Jar

This post is focusing on extent report version 2 but we have new version of extent report 3 and 4 which you can refer using below post.

Extent Report version 3 and 4

If you still want to use an older version then you can follow this post.

You can check the detailed description about extent report from here- Extent Report Documentation

I created a detailed Youtube video on this that will help you to achieve the same.

But before moving forward you should know some of the features that we are going to use in this video.

How to capture screenshot in Selenium

How to capture screenshot in failure only

 

Advance reporting Selenium with Screenshots

 

Download Extent report

1- Open http://extentreports.com/docs/versions/2/java/ and use maven dependency

<dependency>
    <groupId>com.relevantcodes</groupId>
    <artifactId>extentreports</artifactId>
    <version>2.41.2</version>
</dependency>

2- If you are not using maven then you can use jars directly but I would highly recommend you to use maven dependency.

 

Advance reporting Selenium

Now once you are done with above two Video’s now start implementing Version 2

 

 

 

 

Please refer the code which we discussed in above video

Advance reporting Selenium with Screenshots Part 2

package SmokeTest;

import library.Utility;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.Assert;
import org.testng.ITestResult;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test;

import com.relevantcodes.extentreports.ExtentReports;
import com.relevantcodes.extentreports.ExtentTest;
import com.relevantcodes.extentreports.LogStatus;

public class VerifyTitle 
{

ExtentReports report;
ExtentTest logger; 
WebDriver driver;


@Test
public void verifyBlogTitle()
{
report=new ExtentReports("C:\\Report\\LearnAutomation.html");

logger=report.startTest("VerifyBlogTitle");

driver=new FirefoxDriver();

driver.manage().window().maximize();

logger.log(LogStatus.INFO, "Browser started ");

driver.get("http://www.learn-automation.com");

logger.log(LogStatus.INFO, "Application is up and running");

String title=driver.getTitle();

Assert.assertTrue(title.contains("Google")); 

logger.log(LogStatus.PASS, "Title verified");
}


@AfterMethod
public void tearDown(ITestResult result)
{
if(result.getStatus()==ITestResult.FAILURE)
{

String screenshot_path=Utility.captureScreenshot(driver, result.getName());
String image= logger.addScreenCapture(screenshot_path);
logger.log(LogStatus.FAIL, "Title verification", image);


}

report.endTest(logger);
report.flush();

driver.get("C:\\Report\\LearnAutomation.html");
}


}

 

I have not written much for this post because already we have covered the same in past.

For More updates Learn Automation page

For any query join Selenium group- Selenium Group

Filed Under: Basic Selenium Tagged With: Report

Reader Interactions

Comments

  1. Niranjan says

    July 24, 2019 at 3:21 PM

    Hi Mukesh,

    Is there any way we can provide more details related to test case in Extent report? Like I have a test case ID (in a test management tool) corresponding to test case I have automated which I need to display in automated test report…
    Please let me know more on this.

    Reply
    • Mukesh Otwani says

      July 24, 2019 at 9:59 PM

      Hi Niranjan,

      Yes, you can achieve it. You need to call desired API call provided by corresponding Test Management tool in order to fetch test case id while your test execution and use same id into ExtentTest logger or you have to pass it every time manually which is tiresome job.

      Reply
  2. Amandeep Singh Sandhu says

    February 10, 2017 at 4:30 PM

    Hi Mukesh
    We have implemented Keyword Driven Framework in our Product and is working fine. We want Extent Reports in our framework, is it possible to use Extent Reports in Keyword Driven Framework?

    Reply
    • Mukesh Otwani says

      February 10, 2017 at 6:30 PM

      Hi Amandeep,

      First of all, Extent reports API doesn’t depend upon any kind of framework. You can integrate it to your existing framework after adding it to project build path.

      Reply
      • Amandeep Singh Sandhu says

        February 17, 2017 at 2:36 PM

        Thanks Mukesh for your reply!
        Extent Reports API integrated to framework. Is it compulsory to use TestNG for Extent Reports, as of now we are not using TestBG in our framework?

        Reply
        • Mukesh Otwani says

          February 17, 2017 at 4:37 PM

          Hi Amandeep,

          Extent Report APIs works without TestNG also.

          Reply
          • Amandeep Singh Sandhu says

            February 20, 2017 at 11:58 AM

            Thanks Mukesh, I will try at my end. In case of any issue, I will ping for help again 🙂

          • Mukesh Otwani says

            February 20, 2017 at 1:34 PM

            Sure Amandeep 🙂

      • shaik says

        February 18, 2017 at 11:20 PM

        Hi Mukesh
        I would like to leern ANT ,when you upload …..I’m waiting..

        Reply
        • Mukesh Otwani says

          February 19, 2017 at 2:30 PM

          Hi Shaik,

          I am planning for it and will upload soon.

          Reply
  3. triveni reddy says

    February 6, 2017 at 9:17 PM

    Hi Mukesh,

    Will extent reports provide consolidated report. like when I use selenium grid concept of hub to node1 and node2 execution consolidated reports in same html file ?

    Reply
    • Mukesh Otwani says

      February 7, 2017 at 8:13 PM

      Hi Triveni,

      Yes, extent report consolidate the test execution being executed in grid. Because you will be triggering execution from Hub not from node. So all report can be made available on hub machine.

      Reply
  4. Dilip Kumar says

    February 6, 2017 at 12:07 PM

    Hi Mukesh,
    I have multiple tests in different classes.when i execute testng.xml only the last test result is getting updated.
    What should i do to get the status of all the tests to get updated

    Reply
    • Mukesh Otwani says

      February 15, 2017 at 12:14 AM

      Hi Dilip,

      Are you telling about the result coming up in extent report ? Please make it clear.

      Reply
    • Sameer says

      May 11, 2019 at 8:14 PM

      Hi Mukesh,

      I want to use extent report for my project, wherein I have used page object model approach and I want to show the screenshots that I have taken to verify the UI as well as the failed test cases screenshots in the extent report.

      And I want to generate extent report at the Suite level. Any idea about how to achieve this.

      Reply
      • Mukesh Otwani says

        May 13, 2019 at 2:28 PM

        Hi Sameer,

        You can achieve this in many ways, one way is that initialize report object in another class with @BeforeSuite method and extent this class to all your test classes so that same report object can be accessed by all your test methods.

        Reply
  5. Nikhil Nerkar says

    January 25, 2017 at 7:18 PM

    Hello, In your video, against the screenshot in report, I cannot see the text ‘Title verification’ which is mentioned in below line of code. In large frameworks we wont be able to make out which screenshot is for which failure.

    logger.log(LogStatus.FAIL, “Title verification”, image);

    Reply
    • Mukesh Otwani says

      January 28, 2017 at 6:12 PM

      Hi Nikhil,

      Extent report and logger don’t depend on WebDriver object. You can take the screenshot of page where your test case is getting fail. Other things you need to handle from your framework.

      Reply
  6. Atul Vani says

    January 20, 2017 at 7:48 PM

    Hi Mukesh, I followed all steps as you mentioned in video ” but on executing it throws NullPointerException. please help me to solve this problem.

    public class extentReport_Demo1 {

    public WebDriver driver;
    ExtentReports report;
    ExtentTest logger;

    @Test
    public void Launch_Browser(){

    report=new ExtentReports(“C:\\Extent Report\\Atulvani.html”);
    logger = report.startTest(“verifyGoogleTitle”);

    System.setProperty(“webdriver.chrome.driver”, “C:\\Appium Setup\\Browser Driver\\chromedriver.exe”);

    driver=new ChromeDriver();
    logger.log(LogStatus.INFO, “Browser is Launched”);

    driver.get(“http://google.co.in”);
    logger.log(LogStatus.INFO, “Application is Up and Running”);

    driver.manage().window().maximize();
    logger.log(LogStatus.INFO, “Browser is Maximized”);

    String title = driver.getTitle();
    System.out.println(“Title of the page is = “+title);
    logger.log(LogStatus.INFO, “Getting Title of the page successfully”);

    Assert.assertTrue(title.contains(“selenium”));
    logger.log(LogStatus.PASS, “Title is verified”);
    }

    @AfterMethod
    public void tearDown(ITestResult result){

    if(result.getStatus()==ITestResult.FAILURE)
    {
    String screenshot_path=Utility.captureScreenshot(driver, result.getName());
    String image = logger.addScreenCapture(screenshot_path);
    logger.log(LogStatus.FAIL, “Title verification”, image);
    }
    report.endTest(logger);
    report.flush();
    driver.get(“C:\\Extent Report\\Atulvani.html”);
    }
    }

    And For Utility Class….

    public class Utility {

    public static String captureScreenshot(WebDriver driver, String screenshotName){

    try {
    TakesScreenshot ts=(TakesScreenshot)driver;

    File source=ts.getScreenshotAs(OutputType.FILE);

    String dest = “C:\\Extent Report\\ScreenShots\\”+screenshotName+”.png”;

    File destination = new File(dest);

    FileUtils.copyFile(source, destination);

    System.out.println(“ScreenShot Taken”);

    return dest;

    } catch (Exception e) {

    System.out.println(“Exception while taking Screenshot”+e.getMessage());
    return e.getMessage();
    }
    }
    }

    Reply
    • Mukesh Otwani says

      January 21, 2017 at 9:04 PM

      Hi Atul,

      Please check this statement String screenshot_path=Utility.captureScreenshot(driver, result.getName())

      Reply
  7. 37 says

    January 13, 2017 at 1:19 AM

    Hi Mukesh,
    In my report the screenshot is not displayed. What should i do ?

    Reply
    • 37 says

      January 13, 2017 at 1:54 AM

      It is working now. Thanks

      Reply
      • Mukesh Otwani says

        January 13, 2017 at 9:43 AM

        Hi there,

        Happy to hear it worked.

        Reply
    • Mukesh Otwani says

      January 13, 2017 at 10:16 AM

      Hi there,

      Kindly check the path of your report and path for screenshot files.

      Reply
    • Richa says

      January 20, 2017 at 9:14 PM

      In my repot also screenshot not displayed

      Reply
      • Mukesh Otwani says

        January 24, 2017 at 4:06 PM

        Hi Richa,

        make sure you are using Java 8

        Reply
  8. Asha says

    January 12, 2017 at 11:20 AM

    how we can use extend reports in page object model framework

    Reply
    • Mukesh Otwani says

      January 13, 2017 at 10:02 AM

      Hi Asha,

      Yes, you can. Extend report doesn’t restrict itself to any particular framework.

      Reply
  9. Nidhi Tripathi says

    January 6, 2017 at 6:31 PM

    Hi Mukesh,

    Very nice tutorial. Tried implementing extent reports in my project but when using

    logger.log(LogStatus.PASS,”Element Clicked”,image_1);

    I’m just getting the screenshot not getting the message “Element CLicked along with it.

    Reply
    • Mukesh Otwani says

      January 11, 2017 at 4:11 PM

      is this Fixed Nidhi?

      Reply
  10. Nidhi Tripahti says

    January 4, 2017 at 12:43 PM

    Hi Mukesh,
    This is Nidhi , I want to use this extentreport API for the protractor framework. So is it possible to call this library using javascript as protractor uses javascripts for writing the scripts.

    Reply
    • Mukesh Otwani says

      January 11, 2017 at 4:07 PM

      Hi Nidhi,

      Extent report does not support Protractor framework as of now.

      Reply
  11. satish says

    November 29, 2016 at 3:53 PM

    Hi Mukesh,
    This is satish

    I am working with extent reports.Can i know we can change the report name dynamically which is saved in output folder.

    Ex:Can we add test cases status ie PASS/FAIL to report name after execution .

    Could you help me on this

    Reply
    • Mukesh Otwani says

      December 6, 2016 at 2:20 PM

      Yes Satish you can change the name at runtime based on timestamp or any other logic as well. We can add any status as well for test cases.

      Reply
  12. Shobana says

    November 29, 2016 at 1:53 AM

    Hi Mukesh,

    Thanks very much for the great tutorials, learning a lot. I pretty much followed your example to use extent reports, I keep getting this error. I used maven to download the jars, code is almost the same. I would appreciate some tips on how to solve this. Thanks again for your great service.

    Reply
    • Mukesh Otwani says

      December 6, 2016 at 2:23 PM

      is this fixed Shobana?

      Reply
      • Shobana says

        December 6, 2016 at 10:49 PM

        No Mukesh, I retried it still doesn’t work, I can’t make out what is wrong. Any input would be appreciated

        Reply
        • Mukesh Otwani says

          January 11, 2017 at 3:13 PM

          Hope this is fixed now.

          Reply
  13. Deb says

    November 28, 2016 at 11:47 AM

    Hi Mukesh,

    Thanks for the detailed explanation.
    But I am getting a broken html report. Can you please suggest how can that be fixed.

    I have tried using extentreports-2.05.jar as well as extentreports-2.40.jar.

    Reply
    • Mukesh Otwani says

      November 30, 2016 at 7:32 PM

      Try with 2.41

      Reply
  14. Pulkit says

    November 23, 2016 at 11:03 AM

    Hi Mukesh,

    I am not able to download the report from the given link as the link is not working. Did you update the link?

    Reply
    • Mukesh Otwani says

      November 23, 2016 at 1:21 PM

      Hi Pulkit,

      Here is the new link http://extentreports.relevantcodes.com/

      Reply
  15. Bhanu says

    November 21, 2016 at 1:26 PM

    What are steps in report

    Reply
    • Mukesh Otwani says

      November 23, 2016 at 1:17 PM

      Steps in Automation is similar to Step is manual testing.

      Reply
  16. Fion says

    November 17, 2016 at 1:15 PM

    It works, thanks 🙂

    Reply
    • Mukesh Otwani says

      November 23, 2016 at 3:26 PM

      Cheers Fion 🙂

      Reply
  17. Ether says

    October 31, 2016 at 9:15 PM

    Hi Mukesh,
    is this possible to launch the report automatically to the web browser after executing the test

    Reply
    • Mukesh Otwani says

      November 4, 2016 at 10:40 PM

      Hi Ether,

      You can follow below post http://learn-automation.com/send-report-through-email-in-selenium-webdriver/

      Reply
  18. P H says

    October 26, 2016 at 1:41 PM

    Hi Mukhesh ,
    Can you tell me which firefox version we can use for selenium webdriver java jar file 2.53?

    Reply
    • Mukesh Otwani says

      November 5, 2016 at 11:03 PM

      Hi,

      Kindly follow below guide and video http://learn-automation.com/use-firefox-selenium-using-geckodriver-selenium-3/

      Reply
  19. Raghavendra says

    October 19, 2016 at 6:12 PM

    Hi Mukesh,
    Currently i am getting report for individual test cases, but i want to get the report for the entire suite, suppose if there are 20 testcases in suite, it should show the results for 20 testcases (Like 15 passed and 5 failed) and a corresponding graph which shows 15 passed and 5 failed, is there any way of doing this

    Thanks
    Raghavendra

    Reply
    • Mukesh Otwani says

      October 20, 2016 at 1:57 PM

      Hey Raghavendra,

      below link will help http://extentreports.relevantcodes.com/java/#parallel-runs

      Reply
  20. Ashutosh says

    October 19, 2016 at 12:48 PM

    Hi Mukesh, Just want to know one thing if I have teste cases in diff class files and then i create one testng suite then how can i use this extent report concepts, when i try to use as per your blog, in that case only the report is shown with only cases from one class file. Could you please help here.

    Reply
    • Mukesh Otwani says

      October 20, 2016 at 2:13 PM

      Hi Ashutosh,

      Kindly check below link http://extentreports.relevantcodes.com/java/#parallel-runs

      Reply
  21. akhil says

    October 6, 2016 at 8:19 PM

    Hey, Mukesh.

    How can I use ExtentReports when I am running multiple classes using TestNG framework, Do I need to write the below code in all test classes.
    ExtentReports extent;
    ExtentTest logger;

    Reply
    • Mukesh Otwani says

      October 7, 2016 at 7:30 PM

      Hi Akhil,

      StartTest and EndTest you can call for every test and make sure flush method should come at last

      Reply
      • akhil says

        October 12, 2016 at 2:00 PM

        Thanks alot Mukesh.
        So we no need to add Flush after method right.

        Reply
        • Mukesh Otwani says

          October 12, 2016 at 2:24 PM

          yes

          Reply
  22. Devi sri says

    September 28, 2016 at 2:23 PM

    Hi Mukesh,
    Your blog is really awesome. I’ve a doubt. I tried to attach extent report output as a .html file in mail. when i receive mail it’s missing all css. And i tried to convert .html to .pdf and nothing didn’t work. Is there any possiblility to attach the extent report output in mail

    Reply
    • Mukesh Otwani says

      September 29, 2016 at 10:43 AM

      Hi Devi,

      I have shared one post and I have specified some points as well kindly check http://learn-automation.com/send-report-through-email-in-selenium-webdriver/

      Reply
  23. Rahul says

    September 27, 2016 at 11:22 PM

    After executing extent reports are displaying broken image. Can u help me with this

    Reply
    • Mukesh Otwani says

      September 29, 2016 at 10:46 AM

      Hi Rahul,

      The issue is the path of images is not correct so it will show broken icon. Kindly recheck the screenshot path.

      Reply
  24. Ruth says

    September 26, 2016 at 10:12 PM

    Hi Mukesh,

    Is it possible to use extent reports for batch execution. ?

    Reply
    • Mukesh Otwani says

      September 29, 2016 at 11:00 AM

      Hi Ruth,

      Yes we can do that but its tricky check below url for more details http://extentreports.relevantcodes.com/java/#parallel-runs

      Reply
  25. Vadim Z. says

    September 20, 2016 at 10:03 PM

    I’m unable to zoom screenshot, which was includes into report in Firefox, but working fine in Chrome.

    Reply
    • Mukesh Otwani says

      September 29, 2016 at 2:22 PM

      Seems extent report issue.Not sure on this.

      Reply
  26. Rachana says

    September 16, 2016 at 5:06 PM

    Hi Mukesh,

    Just wanted to know weather it is possible for us to add expected and actual result in the extent and report look quite impressive 🙂

    Reply
    • Mukesh Otwani says

      September 19, 2016 at 1:02 PM

      Yes you can add them in logger.log to get into HTML report.

      Reply
  27. Anandhi says

    September 3, 2016 at 10:55 AM

    Dear Mukesh,
    Thank you very much for the great tutorial. Would it be possible to share some information on how to configure ExtentReports in Jenkins CI?

    Best Regards,
    Anandhi

    Reply
    • Mukesh Otwani says

      September 8, 2016 at 12:04 AM

      Hi Anandhi,

      It is same like normal process no other changes in Jenkins.

      Reply
  28. Yogiraj says

    August 19, 2016 at 11:42 AM

    Hi Mukesh,

    in my selenium test project i’m using Page object model where i have different classes for each page and there is one testNG class which has all the test methods/cases. extent reporting works correctly within test methods but i want to add the logs in to same report file from the page classes as well when that particular method is called from testNG test methods.

    e.g. below is my testNG test method which calls login method

    @Test
    public void VerifyLoginSuccess() throws Exception {

    extent= new ExtentReports(“E:\\Report\\MyReport.html”);
    logger=extent.startTest(“VerifyLoginSuccess”);
    driver = new FirefoxDriver();
    LoginPage login = new LoginPage(driver);
    logger.log(LogStatus.INFO, “Browser started “);
    Dashboard dashboard = new Dashboard(driver);
    CommonFunctions cfunction = new CommonFunctions(driver);
    dashboard = login.LoginToHRM(“username”, “password”);
    String ActualText = dashboard.GetDashboardText();
    Assert.assertEquals(ActualText, “Dashboard”,”Successfully logged in”);
    cfunction.LogOut();
    logger.log(LogStatus.INFO, “Portal Log out “);

    }

    Reply
    • Mukesh Otwani says

      September 8, 2016 at 1:34 AM

      You forgot to call endTest and flush method

      Reply
  29. Padmaj says

    August 16, 2016 at 9:50 AM

    Hi Mukesh,

    Thank you so much for writing this blog and guiding us through automation using Selenium . The info and videos are really helpful even for a person who is new to automation.

    Hey I used the Extent Report in my case but getting error. So I copied your code and tried again but getting similar error. Could you please suggest if any changes are needed?

    Here is the error:
    FAILED CONFIGURATION: @AfterMethod tearDown([TestResult name=verifyBlogTitle status=FAILURE method=VerifyTitle.verifyBlogTitle()[pri:0, instance:advancedReport.VerifyTitle@c0edeb] output={null}])
    java.lang.NullPointerException
    at advancedReport.Utility.captureScreenshot(Utility.java:15)
    at advancedReport.VerifyTitle.tearDown(VerifyTitle.java:55)
    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:85)
    at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:510)
    at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:211)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:703)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:816)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1124)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
    at org.testng.TestRunner.privateRun(TestRunner.java:774)
    at org.testng.TestRunner.run(TestRunner.java:624)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:359)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:354)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:312)
    at org.testng.SuiteRunner.run(SuiteRunner.java:261)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1215)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1140)
    at org.testng.TestNG.run(TestNG.java:1048)
    at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:126)
    at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:137)
    at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:58)

    FAILED: verifyBlogTitle
    java.lang.NoClassDefFoundError: freemarker/template/TemplateModelException
    at com.relevantcodes.extentreports.ExtentReports.(ExtentReports.java:85)
    at com.relevantcodes.extentreports.ExtentReports.(ExtentReports.java:419)
    at advancedReport.VerifyTitle.verifyBlogTitle(VerifyTitle.java:27)
    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:85)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:639)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:816)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1124)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
    at org.testng.TestRunner.privateRun(TestRunner.java:774)
    at org.testng.TestRunner.run(TestRunner.java:624)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:359)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:354)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:312)
    at org.testng.SuiteRunner.run(SuiteRunner.java:261)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1215)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1140)
    at org.testng.TestNG.run(TestNG.java:1048)
    at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:126)
    at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:137)
    at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:58)
    Caused by: java.lang.ClassNotFoundException: freemarker.template.TemplateModelException
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    … 27 more

    ===============================================
    Default test
    Tests run: 1, Failures: 1, Skips: 0
    Configuration Failures: 1, Skips: 0

    Reply
    • Mukesh Otwani says

      August 18, 2016 at 9:43 AM

      Hi Padmaj,

      Thanks for nice feedback. I can see null pointer exception in Utility. Have you created this library for screenshot ? If not then first create this lib and then try once again.

      Reply
  30. Yogiraj Ghumade says

    August 11, 2016 at 2:12 PM

    Hi Mukesh,

    i am using extentreports in my sample test as shown in below code, the test is running without errors but it is not creating the html report file, though it creates only empty folder.
    what is missing here?

    Any help on this much appreciated.!!

    Thanks,
    Yogiraj

    public class MyTests {
    ExtentReports extent;
    ExtentTest logger;
    WebDriver driver;

    @Test
    public void VerifyLoginSuccess() throws Exception {

    extent= new ExtentReports(“E:\\Report\\MyReport.html”);
    logger=extent.startTest(“VerifyLoginSuccess”);
    driver = new FirefoxDriver();
    LoginPage login = new LoginPage(driver);
    logger.log(LogStatus.INFO, “Browser started “);
    Dashboard dashboard = new Dashboard(driver);
    CommonFunctions cfunction = new CommonFunctions(driver);
    dashboard = login.LoginToHRM(“username”, “password”);
    String ActualText = dashboard.GetDashboardText();
    Assert.assertEquals(ActualText, “Dashboard”,”Successfully logged in”);
    cfunction.LogOut();
    logger.log(LogStatus.INFO, “Portal Log out “);

    }

    @AfterTest
    public void afterTest() {

    extent.endTest(logger);
    driver.close();
    driver.quit();

    }
    }

    Reply
    • Mukesh Otwani says

      August 18, 2016 at 9:56 AM

      Hi Yogiraj,

      I got the issue. You missed to call flush method after endTest 🙂

      Kindly refer the post again and let me know if still issue persist.

      Reply
      • Yogiraj says

        August 18, 2016 at 11:27 AM

        Thanks Mukesh, that solved the issue, Thanks again and keep up the good work

        Reply
        • Mukesh Otwani says

          August 18, 2016 at 10:41 PM

          Cheers

          Reply
  31. Raghavendra Gupta says

    August 9, 2016 at 12:18 PM

    Hi Mukesh- I am getting ExtentReports link which navigates to “http://extentreports.relevantcodes.com/” in the automation test report. How to avoid displaying this in my automation test report. I have searched different config but no luck. Could you please let me know how to hide that link in my test report. I am using the version 2.41.1

    Reply
    • Mukesh Otwani says

      August 18, 2016 at 10:07 AM

      Hi Raghavendra,

      You can only make these changes to report http://extentreports.relevantcodes.com/java/#configuration

      Reply
  32. salwa samad says

    August 4, 2016 at 2:06 AM

    Hey ,

    This is very informative . I really like your videos .

    I have a question hope you can help me with it.

    Extent reports are email-able reports so when you take a screenshot on failure and save it on your local machine how can you send the full report with the screenshot to someone by email i mean what if i want to send the extent report to someone in my team , they wont get the image on the failed testcase screen as its on my local .

    Can you please advise.

    Thanks
    Salwa

    Reply
    • Mukesh Otwani says

      August 5, 2016 at 11:48 AM

      Hi Salwa,

      In this case store all the screenshot in shared driver and then access and send email http://www.assertselenium.com/java/emailable-reports-for-selenium-scripts/

      Reply
  33. Vishnu Godse says

    July 29, 2016 at 11:28 PM

    Thanks a lot Mukesh… for introducing such wonderful method for advanced reporting.

    Found really helpful and on basis of this article , i have created combined report for multiple Test(s)
    just declared report interface as :

    private static ExtentReports report = new ExtentReports (“G:\\Selenium\\AdvancedReports\\MyReports.html”);;
    private static ExtentTest logger ;

    and started logger = report.startTest(“TC Name”)

    and ended report.endTest and Flush operation under @AfterClass Annotation.

    which worked successfully for me and very impressive combined report has been generated..

    Thanks A lot for this..Great Job!!

    Reply
    • Mukesh Otwani says

      August 2, 2016 at 12:30 PM

      Hey Vishnu,

      Cheers 🙂

      Reply
      • Venkatesh says

        September 8, 2016 at 11:12 AM

        Awesome Mukesh.

        Your videos really help. And i prefer your stuff than any other information from GOOGLE.

        They are really good, informative, clear, interesting, to the point, in sync with up-comming requirements.

        Continue the good work, and share the knowledge with us.

        Reply
        • Mukesh Otwani says

          September 9, 2016 at 10:32 AM

          Hey Venkatesh,

          Thank you mate yes I will continue the same. Your comment related to Google has boosted my energy.

          Reply
  34. Angira Sarkar says

    July 20, 2016 at 12:11 AM

    Hi Mukesh
    I want to implement this reporting with Apache ANT Build.xml file, previously i used Report NG to generate the report now i want to use this Extent reports jar. Please tell me what modifications should i do to my Apache ANT build.xml. I use TestNG.xml to schedule tests.
    Thank u in advance

    Reply
    • Mukesh Otwani says

      July 20, 2016 at 1:45 PM

      Hey Angira,

      You can download jar and keep in lib folder where other files are located. Remaining process will be same.

      I will still suggest you to use maven rather then ant.

      Reply
  35. Shantanu Shukla says

    July 7, 2016 at 5:43 PM

    Hi Mukesh,

    I am getting below exception in my console upon trying to implement extent reports.

    Kindly suggest what shall i do to get rid of this exception:

    java.lang.NoClassDefFoundError: freemarker/template/TemplateModelException
    at com.relevantcodes.extentreports.ExtentReports.(ExtentReports.java:85)
    at com.relevantcodes.extentreports.ExtentReports.(ExtentReports.java:374)
    at com.cgi.tests.reports.REG_TCT1001.beforeMethod(REG_TCT1001.java:31)
    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:86)
    at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:514)
    at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:215)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:589)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:822)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1130)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
    at org.testng.TestRunner.privateRun(TestRunner.java:782)
    at org.testng.TestRunner.run(TestRunner.java:632)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:366)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:361)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:319)
    at org.testng.SuiteRunner.run(SuiteRunner.java:268)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1244)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1169)
    at org.testng.TestNG.run(TestNG.java:1064)
    at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:113)
    at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:206)
    at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:177)
    Caused by: java.lang.ClassNotFoundException: freemarker.template.TemplateModelException
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)

    Reply
    • Mukesh Otwani says

      July 8, 2016 at 11:27 AM

      Hey Shantnu,

      Please download latest jars and add in project. It is due to some jar missing from extent report.

      Reply
  36. Anusha says

    June 3, 2016 at 9:33 AM

    [TestNG] Running:
    C:UsersAR2104AppDataLocalTemptestng-eclipse-1272743253testng-customsuite.xml

    screenshot taken
    FAILED CONFIGURATION: @AfterMethod tearDown([TestResult name=verifySeleniumBlog status=FAILURE method=ExtentReportsEx.verifySeleniumBlog()[pri:0, instance:appium.ExtentReportsEx@6a41eaa2] output={null}])
    java.lang.NullPointerException
    at appium.ExtentReportsEx.tearDown(ExtentReportsEx.java:73)
    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:86)
    at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:514)
    at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:215)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:707)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:820)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1128)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
    at org.testng.TestRunner.privateRun(TestRunner.java:782)
    at org.testng.TestRunner.run(TestRunner.java:632)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:366)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:361)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:319)
    at org.testng.SuiteRunner.run(SuiteRunner.java:268)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1244)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1169)
    at org.testng.TestNG.run(TestNG.java:1064)
    at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:126)
    at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:137)
    at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:58)

    FAILED: verifySeleniumBlog
    java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.access$100(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at org.apache.xerces.parsers.AbstractDOMParser.startDocument(Unknown Source)
    at org.apache.xerces.impl.dtd.XMLDTDValidator.startDocument(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentScannerImpl.startEntity(Unknown Source)
    at org.apache.xerces.impl.XMLVersionDetector.startDocumentParsing(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
    at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
    at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
    at javax.xml.parsers.DocumentBuilder.parse(Unknown Source)
    at com.relevantcodes.extentreports.Configuration.getConfigurationMap(Configuration.java:38)
    at com.relevantcodes.extentreports.Report.loadConfig(Report.java:470)
    at com.relevantcodes.extentreports.Report.(Report.java:607)
    at com.relevantcodes.extentreports.ExtentReports.(ExtentReports.java:72)
    at com.relevantcodes.extentreports.ExtentReports.(ExtentReports.java:373)
    at appium.ExtentReportsEx.verifySeleniumBlog(ExtentReportsEx.java:34)
    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:86)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:643)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:820)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1128)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
    at org.testng.TestRunner.privateRun(TestRunner.java:782)
    at org.testng.TestRunner.run(TestRunner.java:632)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:366)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:361)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:319)
    at org.testng.SuiteRunner.run(SuiteRunner.java:268)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1244)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1169)
    at org.testng.TestNG.run(TestNG.java:1064)
    at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:126)
    at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:137)
    at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:58)
    Caused by: java.lang.ClassNotFoundException: org.w3c.dom.ElementTraversal
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    … 52 more

    im getting the above error

    herre is my code
    import org.openqa.selenium.TakesScreenshot;
    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.firefox.FirefoxDriver;
    import org.testng.Assert;
    import org.testng.ITestResult;
    import org.testng.annotations.AfterMethod;
    import org.testng.annotations.BeforeMethod;
    import org.testng.annotations.Test;

    import com.relevantcodes.extentreports.ExtentReports;
    import com.relevantcodes.extentreports.ExtentTest;
    import com.relevantcodes.extentreports.LogStatus;

    import egs.trailblazer.baseutils.Constants;

    public class ExtentReportsEx {
    ExtentReports report;
    ExtentTest logger;
    WebDriver driver;

    @Test

    public void verifySeleniumBlog(){

    report=new ExtentReports(“F:\SeleniumWorkSpace\TrailBlazer\Reports\LearnAutomation.html”,true);

    logger=report.startTest(“verifySeleniumBlog”);

    driver=new FirefoxDriver();

    driver.manage().window().maximize();

    logger.log(LogStatus.INFO, “Browser started “);

    driver.get(“http://www.learn-automation.com”);

    logger.log(LogStatus.INFO, “Application is up and running”);

    String title=driver.getTitle();

    Assert.assertTrue(title.contains(“Google”));

    logger.log(LogStatus.PASS, “Title verified”);

    }

    @BeforeMethod
    public void before(){

    }

    @AfterMethod
    public void tearDown(ITestResult result) throws IOException
    {
    if(result.getStatus()==ITestResult.FAILURE)
    {
    TakesScreenshot ts = (TakesScreenshot)driver;
    //File source = ts.getScreenshotAs(OutputType.FILE);

    String dest = Constants.screenshotFilePath+”\”+result.getName()+”__”+”.png”;
    File destination = new File(dest);
    //FileUtils.copyFile(source,destination);
    System.out.println(“screenshot taken”);
    String image= logger.addScreenCapture(dest);
    logger.log(LogStatus.FAIL,image, “Title verification”);

    report.flush();

    }

    }

    // driver.get(“..\Report\LearnAutomation.html”);
    }

    Reply
    • Mukesh Otwani says

      June 4, 2016 at 12:21 AM

      please add

      report.endTest(logger);

      Reply
  37. santhosh says

    May 18, 2016 at 4:05 PM

    Hi Mukesh,

    Am running one @Test method on multiple browser parallel using XML.
    now am saving results in different folder like chrome,mozilla

    is it possible to store/get result of the same @test case on diffrent browser using Extent reporting

    public ExtentReports report;
    public ExtentTest logger;

    @Parameters(“MyBrowser”)
    @Test
    public void IB(String MyBrowser) throws Exception{
    WebDriver driverThread=openBrowser(MyBrowser);
    report=Reporter(MyBrowser,report);
    logger=report.startTest(” test started”);
    }
    //——————–
    public ExtentReports Reporter(String MyBrowser,ExtentReports report){

    switch (MyBrowser) {

    case “Firefox”: case “F”: case “FF”: case “remote_firefox”:
    report=new ExtentReports(“HtmlOutput\\FireFox\\TC001.html”);
    return report;
    case “Chrome”: case “C”: case “remote_chrome”:
    report=new ExtentReports(“HtmlOutput\\chrome\\TC001.html”);
    return report;
    case “Internet Explorer”: case “IE”: case “remote_ie”:
    report=new ExtentReports(“HtmlOutput\\InternetExplorer\\TC001.html”);
    return report;
    case “Safari”: case “S”: case “remote_safari”:
    report=new ExtentReports(“HtmlOutput\\Safari\\TC001.html”);
    return report;
    default :
    return report;
    }
    }

    can you please tell me how to save results of same test cases on multiple browser using extent reporting

    Thank you in advance

    note:sorry my previous email Id was wrong

    Reply
    • Mukesh Otwani says

      May 19, 2016 at 4:24 AM

      you can use timestamp for this.

      Reply
  38. Reema Shah says

    April 23, 2016 at 1:20 AM

    Hi Mukesh,
    Thank you for the beautiful explanation.
    I used the same code for generating the report but it does not create the report in destination folder.
    Test scripts are executed and no errors are generated..
    Below is my code:
    package com.learnTestNG;

    import org.testng.annotations.Test;
    import static org.testng.Assert.*;
    import java.util.Iterator;
    import java.util.List;
    import java.util.concurrent.TimeUnit;
    import org.openqa.selenium.By;
    import org.openqa.selenium.StaleElementReferenceException;
    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.WebElement;
    import org.openqa.selenium.firefox.FirefoxDriver;
    import org.openqa.selenium.firefox.FirefoxProfile;
    /*import org.testng.annotations.AfterMethod;
    import org.testng.annotations.BeforeMethod;*/
    //import org.testng.annotations.Test;
    import org.testng.annotations.BeforeTest;
    import org.testng.annotations.AfterTest;
    //import org.testng.annotations.Optional;
    //import com.beust.jcommander.Parameter;
    import com.relevantcodes.extentreports.ExtentReports;
    import com.relevantcodes.extentreports.ExtentTest;
    import com.relevantcodes.extentreports.LogStatus;

    public class TestRedBus
    {
    /*public static*/ static WebDriver driver;
    private static String baseUrl;
    ExtentReports report;
    static ExtentTest logger;
    private String filePath=”C:\\Script Report\\RedBusReport.html”;

    @BeforeTest
    public void beforeTest()
    {
    report=new ExtentReports(filePath);
    logger=report.startTest(“Verify Home page for RedBus.in”);
    driver = new FirefoxDriver();
    FirefoxProfile fxprofile=new FirefoxProfile();
    fxprofile.setAssumeUntrustedCertificateIssuer(true);
    fxprofile.setAcceptUntrustedCertificates(true);
    //driver.manage().window().maximize();
    logger.log(LogStatus.INFO, “Browser is up and running”);
    baseUrl= “https://www.redbus.in/”;
    driver.get(baseUrl);
    logger.log(LogStatus.INFO, “Application is up and running”);
    System.out.println(“Current URL is ” +driver.getCurrentUrl()) ;
    System.out.println(driver.getTitle());
    logger.log(LogStatus.INFO, “Got the title of application home page”);
    driver.manage().timeouts().implicitlyWait(60,TimeUnit.SECONDS);
    }

    @Test
    /*Enter source destination and
    * click on datepicker icon and then click on next button from calendar*/

    public void TestHomePage() throws InterruptedException
    {

    driver.findElement(By.id(“txtSource”)).sendKeys(“Mumbai”);
    driver.findElement(By.id(“txtDestination”)).sendKeys(“pune”);
    logger.log(LogStatus.INFO, “Entered Source and destination”);
    }
    @Test
    public static void testSelectOnwardDate() throws InterruptedException
    {
    System.out.println(“——————Staring with onward journey—————“);
    driver.findElement(By.id(“txtOnwardCalendar”)).click();
    driver.findElement(By.xpath(“.//*[@id=’rbcal_txtOnwardCalendar’]/table[2]/tbody/tr[1]/td[3]/button”)).click();
    Thread.sleep(3000);
    String date =”13-Jun 2016″;
    String splitter[]= date.split(“-“);
    System.out.println(splitter);
    String CheckInDay= splitter[0];
    String CheckInMonth_Year= splitter[1];
    System.out.println(CheckInDay);
    System.out.println(CheckInMonth_Year);

    //to get the month and year from Onward calendar
    List elements = driver.findElements(By.xpath(“.//div[@class=’Calendar’]/table/tbody/tr[@class=’monthHeader’]/td[@class=’monthTitle’]”));
    for (int i=0; i<elements.size(); i++)
    {
    System.out.println(elements.get(i).getText());
    if(elements.get(i).getText().equals(CheckInMonth_Year))
    {
    System.out.println("————————");
    //selecting the date

    List days = driver.findElements(By.xpath(“.//*[@id=’rbcal_txtOnwardCalendar’]/table[contains(@class ,’month’)][2]/tbody/tr/td[contains(@class, ‘day’)]”));
    for(WebElement d : days)
    {
    System.out.println(d.getText());
    if(d.getText().equals(CheckInDay))
    {
    d.click();
    Thread.sleep(3000);
    break;
    }
    }
    logger.log(LogStatus.INFO, “Selected onward journey date”);
    }
    }
    }

    @Test
    public static void testSelectReturnDate() throws InterruptedException
    {

    //Exception e= new Exception();
    System.out.println(“———-Staring function for return journey————–“);
    driver.findElement(By.id(“txtReturnCalendar”)).click();
    //driver.findElement(By.xpath(“.//*[@id=’rbcal_txtReturnCalendar’]/table[2]/tbody/tr[1]/td[3]/button”)).click();
    String Return_date =”14-Jun 2016″;
    String splitter_Date[]= Return_date.split(“-“);
    System.out.println(splitter_Date);
    String CheckOutDay= splitter_Date[0];
    String CheckOutMonth_Year= splitter_Date[1];
    System.out.println(CheckOutDay);
    System.out.println(CheckOutMonth_Year);
    try
    {
    //Selecting month and year from return calendar
    List elements = driver.findElements(By.xpath(“.//div[@id=’rbcal_txtReturnCalendar’]/table[contains(@class, ‘monthTable’)]/tbody/tr[@class=’monthHeader’]/td[@class=’monthTitle’]”));
    System.out.println(“—————Starting calculation for date/moth/year selection from calendar————-“);

    for(int j=0; j<elements.size(); j++)
    {
    System.out.println(elements.get(j).getText());

    Thread.sleep(3000);
    if(elements.get(j).getText().equals(CheckOutMonth_Year))
    {
    System.out.println("————————");
    //selecting the dates from return calendar

    List Returndays = driver.findElements (By.xpath(“.//*[@id=’rbcal_txtReturnCalendar’]/table[contains(@class ,’month’)][1]/tbody/tr/td[contains(@class, ‘day’)]”));
    for(WebElement d : Returndays)
    {
    System.out.println(d.getText());
    if(d.getText().equals(CheckOutDay))
    {
    d.click();
    Thread.sleep(3000);
    break;
    }
    }
    }
    }

    }
    catch(StaleElementReferenceException e)
    {
    e.printStackTrace();
    e.toString();
    System.out.println(“Trying to recover from Stale element ” +e.getMessage());
    }

    logger.log(LogStatus.INFO, “Selected return journey date”);
    driver.findElement(By.id(“searchBtn”)).click();
    logger.log(LogStatus.INFO, “Clicked on search buses”);
    System.out.println(driver.getTitle());
    logger.log(LogStatus.PASS, “Navigated to search buses page.”);
    }

    @AfterTest
    public void afterTest()
    {
    /* report.endTest(logger);
    report.flush();
    driver.close();
    driver.quit();*/
    //driver.get(“C:\\Script Report\\RedBusReport.html”);
    }

    }

    Reply
    • Mukesh Otwani says

      April 26, 2016 at 5:38 PM

      Hi,

      EndTest will generate report.

      Reply
  39. Kumar says

    March 28, 2016 at 4:14 PM

    Hi Mukesh,

    I followed all the steps exactly as you have mentioned in the video and downloaded the jar from http://mvnrepository.com/. But still I am getting below error when I run my tests.

    FAILED CONFIGURATION: @AfterMethod tearDown([TestResult name=tc1 status=FAILURE method=ReportTest.tc1()[pri:0, instance:testScripts.ReportTest@36b98809] output={null}])
    java.lang.NullPointerException
    at testScripts.ReportTest.tearDown(ReportTest.java:44)
    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)

    FAILED: tc1
    java.lang.NoClassDefFoundError: freemarker/template/TemplateException
    at com.relevantcodes.extentreports.ExtentReports.(ExtentReports.java:84)
    at com.relevantcodes.extentreports.ExtentReports.(ExtentReports.java:230)
    at testScripts.ReportTest.tc1(ReportTest.java:24)
    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.invokeMethod(Invoker.java:714)
    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)
    Caused by: java.lang.ClassNotFoundException: freemarker.template.TemplateException
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    … 27 more

    ===============================================
    Default test
    Tests run: 1, Failures: 1, Skips: 0
    Configuration Failures: 1, Skips: 0
    ===============================================

    ++++++++++++++++++++++++++++++++++++++++++++++++
    this is my code

    package testScripts;

    import java.util.concurrent.TimeUnit;

    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.firefox.FirefoxDriver;
    import org.testng.*;
    import org.testng.annotations.AfterMethod;
    import org.testng.annotations.Test;

    import com.relevantcodes.extentreports.ExtentReports;
    import com.relevantcodes.extentreports.ExtentTest;
    import com.relevantcodes.extentreports.LogStatus;

    public class ReportTest {

    ExtentReports report;
    ExtentTest extentre;
    WebDriver driver;

    @Test
    public void tc1()
    {
    report = new ExtentReports(“C:\\Report.html”);
    extentre = report.startTest(“Verify the title”);
    driver = new FirefoxDriver();
    driver.get(“http://www.google.com”);
    driver.manage().window().maximize();
    extentre.log(LogStatus.INFO, “Browser Launched”);
    driver.manage().timeouts().implicitlyWait(5000 ,TimeUnit.SECONDS);
    String name = driver.getTitle();
    Assert.assertTrue(name.contains(“Google”));
    extentre.log(LogStatus.PASS, “Title verified”);
    }

    @AfterMethod
    public void tearDown(ITestResult result)
    {
    if(result.getStatus()==ITestResult.SUCCESS)
    {
    extentre.log(LogStatus.INFO, “Inside Success”);
    }

    report.flush();
    report.close();

    //driver.get(“D:\\ExtentReport\\Report.html”);

    }
    }

    Reply
    • Mukesh Otwani says

      March 28, 2016 at 5:01 PM

      Hi Kumar,

      Make sure all four jars added as I mentioned the above post.

      Please end the test then only it will create report.

      Add below code

      report.endTest(logger);

      remove this code

      report.close();

      Reply
      • Nitin says

        March 29, 2016 at 9:35 PM

        Hi Mukesh,

        Despite failing the TC, it is not able to upload screenshot on Extent Report Path [C:\\Reports\\Learn-Automation.html].

        It seems the code String image = logger.addScreenCapture(screenshot_path); does not work anymore and they may have modified the same or maybe am missing something.

        Please clarify.

        Thank you,
        Nitin

        Reply
        • Mukesh Otwani says

          April 1, 2016 at 5:14 PM

          Hi Nitin,

          Its working fine I just checked Cheers 🙂

          Reply
        • VikramShaRma says

          July 28, 2016 at 10:50 PM

          hi Mukesh i added all jars show in snapshot then its working as expected.
          Thanks alot

          Reply
          • Mukesh Otwani says

            August 2, 2016 at 12:34 PM

            Hey Vikaram,

            Cheers for new report.

  40. Garima Verma says

    March 21, 2016 at 10:06 PM

    Hi Mukesh,

    I am trying to use relative path for adding a screenshot in my report but not sure why its not working-

    Here is how i am adding taking a screenshot –

    public static String captureScreenshot(WebDriver driver, String screenshotName)
    {
    try {
    TakesScreenshot ts = (TakesScreenshot)driver;
    File source = ts.getScreenshotAs(OutputType.FILE);
    String destold = “./target/runscreenshots/”;
    String dest = destold + screenshotName + “.png”;
    File destination = new File(dest);
    FileUtils.copyFile(source,destination);
    System.out.println(“screenshot taken”);
    return dest;
    }
    catch (Exception e)
    {
    System.out.println(“Exception while taking a screensht” +e.getMessage());
    return e.getMessage();
    }
    }
    and here is how i am adding to report
    logger.log(LogStatus.PASS, methodname + ” Add Attempt Success“);
    String image = this.captureScreenshot(driver, methodname + “Success”);
    System.out.println(“After capture”);
    String image1 = logger.addScreenCapture(image);
    System.out.println(“after image 1″ +image1);
    logger.log(LogStatus.INFO, methodname + ” Screenshot: “, image1);
    System.out.println(“after log” +image1);
    report.flush();

    Absolute paths are working fine but not sure why screenshot does not get attached using relative path. Any help would be appreciate. Thanks!

    Reply
    • Mukesh Otwani says

      March 26, 2016 at 2:07 PM

      Hi Garima,

      Ideally relative path also should work I will try in my machine and will let u know.

      Have a nice weekend.

      Reply
      • kishore says

        April 22, 2016 at 8:09 PM

        Am really after using your report but am also facing the same problem

        Reply
        • Mukesh Otwani says

          April 26, 2016 at 5:40 PM

          Thanks 🙂 what issue u r facing?

          Reply
  41. Rahul says

    March 18, 2016 at 11:41 PM

    Hi Mukesh,

    I want to add Extent report at listeners and logging level on my project such that test logging that i input at test scripts and listeners output both will be available after execution of the test suite. Basically i want to mix extent report at listeners and logging level simultaneously. Currently while trying to add testng is executing single method twice from logging and from extent report but I want that to execute single method only and both logging and result any exception comes in a single method.

    Please help.

    Cheers!!

    -Rahul

    Reply
    • Mukesh Otwani says

      March 20, 2016 at 7:24 PM

      Hi Rahul,

      Can you send me ur code so that I can check and modify accordingly as per requirements.

      Reply
  42. Manu says

    March 17, 2016 at 1:23 AM

    Hi How you have added import library.Utility in “Advanced Selenium Reporting with Screenshots Part 2”.
    Dow we need any separate jar file for this?

    Thanks

    Reply
    • Mukesh Otwani says

      March 20, 2016 at 7:37 PM

      HI Manu,

      We have created this Utility to read excel refer below link for more details https://www.youtube.com/watch?v=sbBdj4zIMqY

      Reply
  43. muthu says

    March 6, 2016 at 10:59 AM

    Hi Mukesh,

    i had written the below code,

    @Test
    public void highestFareTest() throws IOException {

    String Path = “F:\\MyProject\\redbus\\test-output\\Extent.html”;
    ExtentReports extent = new ExtentReports(Path);

    ExtentTest test=extent.startTest(testName);

    new homePage(driver).searchBus(td.getData());
    test.log(LogStatus.PASS, “Site launched”);

    extent.endTest(test);

    }

    problem is test is getting executed , but extent.html file is not generated in the given path.

    Am using 2.40 jar of extent report.

    Reply
    • Mukesh Otwani says

      March 7, 2016 at 10:50 AM

      PLease add flush method after endtest

      Reply
  44. Subramanya Baliga says

    February 25, 2016 at 12:16 PM

    Hi Mukesh,

    Subramanya here. Would like to know how to share this extent report with screenshot to clients ? I did go through your comments section and came across a solution to keep screenshots in shared folder. Is there any other alternative solution for this ?

    Reply
    • Mukesh Otwani says

      March 3, 2016 at 2:15 PM

      HI Subramanya,

      I would recommend shared folder only because we are also using the same approach.

      Reply
  45. divman says

    February 9, 2016 at 9:03 AM

    Hi, It is very useful to me and i implemented in my project. But in the report i am not seeing the screenshot picture taken. I used the same code from your blog. Could you please let me know what should i do?

    Reply
    • Mukesh Otwani says

      March 7, 2016 at 11:04 AM

      Hi Divman,

      Please make sure that screenshot path is absolute (exact path relative path wont work).

      Let me know if still not fixed.

      Reply
  46. Angad says

    January 21, 2016 at 12:58 AM

    Hello Mukesh,

    I am not able to fetch screenshot using the above code , in Extent Report html file a, i am getting blank page screenshot. Can you please guide where i am going wrong ?

    Here is my code :-

    public class Login_To_Force
    {

    ExtentReports extent;
    ExtentTest test;
    WebDriver driver;

    @BeforeTest
    public void base()
    {
    extent = ExtentManager.Instance();

    // extent = new ExtentReports(“./ExtentReport.html”, true);
    driver = new FirefoxDriver();
    driver.get(“https://test.salesforce.com/”);
    driver.manage().window().maximize();
    driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
    }

    @Test(priority=1)

    public void LogintoSalesForce() throws InterruptedException
    {

    ExcelUtils Exceldata = new ExcelUtils(“TestData-SF.xls”, “Login”);

    //Actions myaction = new Actions(driver);

    Login loginsalesforce = PageFactory.initElements(driver,Login.class);

    test = extent.startTest(“Login Page”, “Verify login to Sales Force”);

    loginsalesforce.enterUserName(Exceldata.getCell(3, 0));
    test.log(LogStatus.PASS,”Enter Username”);

    loginsalesforce.enterPassWord(Exceldata.getCell(3, 1));
    test.log(LogStatus.PASS, “Enter Password”);

    loginsalesforce.clickSignin();

    test.log(LogStatus.PASS, “Click on Sign in button”);

    }

    @AfterMethod

    public void sShot(ITestResult result)
    {
    if(result.getStatus()==ITestResult.SUCCESS)
    {

    String screenshot_path=ExtentManager.CaptureScreen(driver, result.getName());
    String image= test.addScreenCapture(screenshot_path);
    test.log(LogStatus.PASS, “XYZ”, image);
    }
    }

    @AfterClass
    public void tear()
    {
    extent.endTest(test);
    extent.flush();
    extent.close();
    driver.quit();
    }

    Reply
    • Mukesh Otwani says

      January 21, 2016 at 8:18 PM

      Change below line

      before
      test.log(LogStatus.PASS, “XYZ”, image);

      After

      test.log(LogStatus.PASS, image,“XYZ”);

      Reply
  47. Loren says

    January 19, 2016 at 1:46 PM

    It works !!! 😉
    Thank you very much for your help . *hug* ;-)))

    Cheers
    Loren

    Reply
    • Mukesh Otwani says

      January 20, 2016 at 1:04 AM

      Hey Loren,

      Great Cheers 🙂

      Reply
  48. puneet jain says

    January 19, 2016 at 1:11 AM

    Hi Mukesh,

    How will i used extent report in key word-driven frame work? .

    As in framework there are 3 or more step against each test cases. so will i implement this in such a way that each test case content it test steps in hierarchy way.

    below piece of code return the result for test cases parent0 only. not for parent 1 and parent 2.

    public static void main(String arg[])
    {
    ExtentReports extent=new ExtentReports(“./demo.html”);

    ExtentTest parent=null;

    for(int i=0;i<3;i++){

    parent = extent.startTest("Parent"+i);

    for(int j=i;i<3;i++){

    ExtentTest child1 = extent.startTest("Child 1");
    child1.log(LogStatus.INFO, "Info from method"+j);

    parent
    .appendChild(child1);

    }
    extent.endTest(parent);
    extent.flush();

    }
    }

    Please have a look.

    Thank,
    Puneet Jain

    Reply
    • Mukesh Otwani says

      January 20, 2016 at 1:11 AM

      Hi Puneet,

      Please follow below link to perform ur task

      http://extentreports.relevantcodes.com/java/version2/docs.html#parallel-classes

      Reply
  49. Loren Lai says

    January 14, 2016 at 10:15 PM

    Hello,

    it seems that my last comment is deleted. 🙁
    Anyway, maybe I can ask once again.

    Question: How can I use only ONE “myReport.html” for two TestClassess ?
    E.g. I have two test classes, which I will execute via testng.xml …

    How should I configure the path to the myReport.html in my test class ?

    public class TestClass1() {

    @Test
    public void verifyBlogTitle() {
    report=new ExtentReports(“C:\\Report\\myReport.html”);
    ….
    }
    }

    public class TestClass2() {

    @Test
    public void verifyBlogTitle() {
    report=new ExtentReports(“C:\\Report\\myReport.html”);
    ….
    }
    }

    Thank you in advance.

    Cheers
    Loren

    Reply
    • Mukesh Otwani says

      January 16, 2016 at 11:53 PM

      Hi Loren,

      Here you go

      http://extentreports.relevantcodes.com/java/version2/docs.html#parallel-classes

      Reply
  50. Loren Lai says

    January 14, 2016 at 8:46 PM

    Hello Mukesh,

    great tutorial and example 😉 Thank you for that.
    I have two questions, please:

    1) When I execute the 2 classes in testng.xml, e.g.

    …

    …

    My report is generate but it shows only test results from MyTestExample2 .

    Question: How to get only 1 myReport.html for 2 running MyTestExample1 & MyTestExample2 ?

    ————————————————————————–
    public class MyTestExample1 () {

    ExtentReports report = new ExtentReports(“C:\\\\Report\\myReport.html”);
    ExtentTest logger;

    @Test
    public void tc1() {}

    @Test
    public void tc2() {}

    …
    }

    public class MyTestExample2 () {

    ExtentReports report = new ExtentReports(“C:\\\\Report\\myReport.html”);
    ExtentTest logger;

    @Test
    public void tc1() {}

    @Test
    public void tc2() {}

    …
    }

    2) Currently when I execute the test in eclipse I get this warning or error in console

    Jan 14, 2016 4:02:04 PM com.relevantcodes.extentreports.Configuration
    INFORMATION: Configurating report from file:/C:/MyEclipseIDEForJavaDev/MYARCHIVES/extentreports-2.40.0/extentreports-java-2.40.0.jar!/com/relevantcodes/extentreports/resources/extent-config.xml

    Question: What does it mean and how can I solve it, please?

    Thank you for your help in advance.

    Cheers
    Loren

    Reply
    • Mukesh Otwani says

      January 17, 2016 at 12:00 AM

      Hi Loren,

      This is just some warning which is giving some information about template.

      I have sent a link in last comment please check and try the same.

      Reply
  51. sonam says

    January 8, 2016 at 3:48 PM

    hi manish i am getting below mentioned error while executing the same code
    com.relevantcodes.extentreports.Configuration
    INFO: Configurating report from file:/D:/selenium/extentreports-java-v2.40%20(1)/extentreports-2.40.0/extentreports-java-2.40.0.jar!/com/relevantcodes/extentreports/resources/extent-config.xml
    FAILED CONFIGURATION: @AfterMethod teardown([TestResult name=verifytitle status=FAILURE method=ExtentReport.verifytitle()[pri:0, instance:ExtentReport@18aecf1] output={null}])

    please let me know the solution to come oot from this error. I have used 2.40 latest version

    Reply
    • Mukesh Otwani says

      January 9, 2016 at 5:22 PM

      Hi Sonam,

      Actually it known issue please download all jars from below link and add into project.

      Try again and let me know if still issue exist.

      In this video, we will use extent version 2 and will create advanced Selenium reporting with screenshot adding on failure.

      Download Jars from below location

      http://relevantcodes.com/wp-content/plugins/download-monitor/download.php?id=17

      Reply
  52. sree says

    December 22, 2015 at 9:41 AM

    Hi Mukesh,

    I followed all the steps exactly as you have mentioned in the video. But I am getting below error when I run my tests.

    Dec 22, 2015 9:28:50 AM com.relevantcodes.extentreports.Configuration
    INFO: Configurating report from file:/C:/Users/skara1/Desktop/lib/extentreports-2.40.jar!/com/relevantcodes/extentreports/resources/extent-config.xml
    FAILED CONFIGURATION: @BeforeMethod init
    java.lang.NoClassDefFoundError: freemarker/template/TemplateException
    at com.relevantcodes.extentreports.ExtentReports.(ExtentReports.java:84)
    at com.relevantcodes.extentreports.ExtentReports.(ExtentReports.java:230)
    at SmokeTest.SampleTests.init(SampleTests.java:29)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

    Reply
    • Mukesh Otwani says

      December 23, 2015 at 12:33 AM

      Hi Sree,

      is it fixed now ?

      Reply
      • Jessy says

        December 25, 2015 at 12:01 AM

        Great tutorial but I am getting the error as shown below.

        [TestNG] Running:
        /private/var/folders/nf/yn_rmw7n0_5b08g50whn4jw80000gn/T/testng-eclipse-1248709115/testng-customsuite.xml

        Dec 24, 2015 7:19:50 PM com.relevantcodes.extentreports.Configuration
        INFO: Configurating report from file:/Users/Xavier/Documents/workspace/extentreports-2.40.jar!/com/relevantcodes/extentreports/resources/extent-config.xml
        Expection while taking a screenshotnull
        FAILED CONFIGURATION: @AfterMethod tearDown([TestResult name=verifyTitle status=FAILURE method=VerifyTitle.verifyTitle()[pri:0, instance:SmokeTest.VerifyTitle@6b71769e] output={null}])
        java.lang.NullPointerException
        at SmokeTest.VerifyTitle.tearDown(VerifyTitle.java:128)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
        at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:510)
        at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:211)
        at org.testng.internal.Invoker.invokeMethod(Invoker.java:708)
        at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:821)
        at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1131)
        at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:124)
        at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
        at org.testng.TestRunner.privateRun(TestRunner.java:773)
        at org.testng.TestRunner.run(TestRunner.java:623)
        at org.testng.SuiteRunner.runTest(SuiteRunner.java:357)
        at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:352)
        at org.testng.SuiteRunner.privateRun(SuiteRunner.java:310)
        at org.testng.SuiteRunner.run(SuiteRunner.java:259)
        at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
        at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
        at org.testng.TestNG.runSuitesSequentially(TestNG.java:1185)
        at org.testng.TestNG.runSuitesLocally(TestNG.java:1110)
        at org.testng.TestNG.run(TestNG.java:1018)
        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)

        FAILED: verifyTitle
        java.lang.NoClassDefFoundError: freemarker/template/TemplateException
        at com.relevantcodes.extentreports.ExtentReports.(ExtentReports.java:84)
        at com.relevantcodes.extentreports.ExtentReports.(ExtentReports.java:230)
        at SmokeTest.VerifyTitle.verifyTitle(VerifyTitle.java:99)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
        at org.testng.internal.Invoker.invokeMethod(Invoker.java:639)
        at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:821)
        at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1131)
        at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:124)
        at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
        at org.testng.TestRunner.privateRun(TestRunner.java:773)
        at org.testng.TestRunner.run(TestRunner.java:623)
        at org.testng.SuiteRunner.runTest(SuiteRunner.java:357)
        at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:352)
        at org.testng.SuiteRunner.privateRun(SuiteRunner.java:310)
        at org.testng.SuiteRunner.run(SuiteRunner.java:259)
        at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
        at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
        at org.testng.TestNG.runSuitesSequentially(TestNG.java:1185)
        at org.testng.TestNG.runSuitesLocally(TestNG.java:1110)
        at org.testng.TestNG.run(TestNG.java:1018)
        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)
        Caused by: java.lang.ClassNotFoundException: freemarker.template.TemplateException
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        … 27 more

        ===============================================
        Default test
        Tests run: 1, Failures: 1, Skips: 0
        Configuration Failures: 1, Skips: 0
        ===============================================

        =============================================

        Reply
        • Mukesh Otwani says

          December 25, 2015 at 1:08 AM

          Hi Jessy,

          I have noticed the same issue if you will download jar then it issue will come.

          Option 1- Download below jars to support extent report.

          Please find the attachment and download jar from maven repo http://mvnrepository.com/

          Option 2- Use Maven project and use below dependency in POM.xml


          com.relevantcodes
          extentreports
          2.40

          Thanks
          Mukesh

          Reply
      • Jessy says

        December 25, 2015 at 5:15 PM

        Hi Mukesh

        I have to say that I had extentreports-2.40.jar already added to the project. I changed it to extentreports-2.05.jar and now it works.
        This tutorial would not work with the new version.

        Regards,
        Jessy

        Reply
        • Mukesh Otwani says

          December 29, 2015 at 10:10 PM

          Great Jessy Cheers.

          Reply
      • Jessy says

        December 25, 2015 at 5:35 PM

        And option two works fine for Maven project.

        Reply
        • Mukesh Otwani says

          December 29, 2015 at 10:07 PM

          Ok Great Jessy

          Reply
  53. shah says

    December 1, 2015 at 1:32 PM

    my test didn’t work,although i follow your instruction precisely

    Reply
    • Mukesh Otwani says

      December 2, 2015 at 1:05 AM

      Have you gone through video 1 and video 2 ?

      Reply
  54. shah says

    December 1, 2015 at 1:31 PM

    Hi,Mukesh!I did exactly as you did but my program is not runniing it just showing an error

    Reply
    • Mukesh Otwani says

      December 2, 2015 at 1:06 AM

      Hi Shah,

      What error is coming?

      Reply
  55. Jeevan Apte says

    November 20, 2015 at 7:07 AM

    how to send this report to client?

    Reply
    • Mukesh Otwani says

      November 21, 2015 at 11:31 PM

      Hi Jeevan,

      First of all sorry for late reply. You can send this report without CSS. Screenshot will not be visible because location will change.

      You can store all screenshot to a separate shared folder where everyone have access and make the changes in screenshot path.

      Thanks
      Mukesh

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Free Selenium Videos

https://www.youtube.com/watch?v=w_iPCT1ETO4

Search topic

Top Posts & Pages

  • Selenium Webdriver tutorial for beginners
  • How To Fix Eclipse Autocomplete Or Code Suggestion In Eclipse
  • Selenium Webdriver C# Tutorial
  • WHAT ARE YOUR EXPECTATIONS FROM US?

Stay connected via Facebook

Stay connected via Facebook

Archives

Footer

Categories

Recent Post

  • API Testing Using Postman And RestAssured
  • Disable Personalise Your Web Experience Microsoft Edge Prompt In Selenium
  • How To Fix Error: No tests found In Playwright
  • How To Fix Eclipse Autocomplete Or Code Suggestion In Eclipse
  • Best and easy way to Group test cases in selenium

Top Posts & Pages

  • Selenium Webdriver tutorial for beginners
  • How To Fix Eclipse Autocomplete Or Code Suggestion In Eclipse
  • Selenium Webdriver C# Tutorial
  • WHAT ARE YOUR EXPECTATIONS FROM US?