Similar Posts

28 Comments

  1. Hi Raj,

    Does Extent Report support multiple suite reports in a Single report.

    Say, I have 3 suites and all the 3 TestNG suites were in my pom.xml and I will be kicking the pom.xml for running my suites.

    My query is, I want to have all the tests info in a single Extent Report.

    @BeforeSuite
    public static void startReport() {

    String name = “C://Reports//TestAutomationResults -” + getDate();
    System.out.println(“HTML REPORT LOCATION IS :: ************* ” + name);

    extent = new ExtentReports(name + “.html”, false);

    extent.addSystemInfo(“Host Name”, “CABS”)
    .addSystemInfo(“Environment”, “QA”)

    extent.loadConfig(new File(System.getProperty(“user.dir”) + “\\extent-config.xml”));

    }

    Please let me know If I am not clear

  2. Can this be used without TestNG project ? If so , can you please guide me .I am getting the error message “The method setSystemInfo(String, String) is undefined for the type ExtentReports”

      1. Hi Rajkumar ,

        I was able to fix that issue .My class name was also ExtentReports and hence was facing this issue .Once i renamed the class , it worked fine .
        I have two more questions :
        -> test..log(Status.PASS, MarkupHelper.createLabel(result, ExtentColor.GREEN));
        How to pass some more arguments in the above command . I want to show the Step Description and the Actual Result. Now it is allowing me to pass only one argument in addition to the status
        -> Time Taken in Dashboard is displayed in “ms” .Can we display that in hh:mm:ss format?

  3. Thanks Rajkumar for the response . Do have an idea about the 2nd query

    -> Time Taken in Dashboard is displayed in “ms” .Can we display that in hh:mm:ss format?

  4. Not getting where we need to put our test code in the extent report?
    In other words, I am not getting how can I get results of my tests?
    I am new to it and using page object framework (from toolsqa website). Can I use this extent report code for my page object structure?

    1. Hi Amit, you can use extent reports. Place @BeforeTest and @AfterMethod in your base class and call logger wherever it is necessary in your test scripts.
      Thanks,
      Rajkumar

      1. Thanks Raj….its working now for individual tests (when running as TestNG), generating report successfully. 🙂
        Now tried a lot to run it for multiple tests, it’s not working. I had already changed @BeforeTest and @AfterTest to @BeforeSuite and @AfterSuite respectively.
        My TestNG is-

        When I ran it as a suite, 1st test get passed, 2nd gets failed and 3rd test gets skipped (all 3 tests contains same code of login, just replicas of each other) with no extent report gets generated.
        If I put Test1_TC at first place and SignIn_TC at second place, it gives same results (1st-passed, 2nd-failed, 3rd-skipped )
        Please help.

          1. ?class name=”testCases.SignIn_TC” /?
            ?class name=”testCases.Test1_TC” /?
            ?class name=”testCases.SearchaStore_TC” /?

  5. Hi,

    Thank you for your tutorial. It is extremely helpful. When I am executing Extent Reports. I am getting error message. See my code below.

    I tried posting the code. but I am unsuccessful.

      1. No, It is not getting created at that location. I have the correct code. But did you take a look at my code. I am getting a stack trace message. The location is specified correctly in the code. Something else is wrong. Maybe I am missing some jars.????

        1. You cannot pass location this way..
          htmlReporter = new ExtentHtmlReporter(System.getProperty(“user.dir”) + “C:\\selenium\\extent_reports\\STMExtentReport.html”);
          Change the above statement.
          htmlReporter = new ExtentHtmlReporter(System.getProperty(“user.dir”) + “/test-output/STMExtentReport.html”);

          1. I was able to fix my Issue. I did not all the JAR files installed in my eclipse. It is all working now.

            thanks in advance

Leave a Reply

Your email address will not be published.