Update: The post has been updated to the latest release (v3.x.x).

I’m happy to announce that now the Cucumber Extent Report comes with the support for configuring your ExtentX dashboard. And moreover, introducing ExtentProperties enum to help you to configure extent related settings.

If you are using a maven based project, you can directly add this library as a dependency:

<dependency>
    <groupId>com.vimalselvam</groupId>
    <artifactId>cucumber-extentsreport</artifactId>
    <version>3.0.0</version>
</dependency>

Please note that Java 8+ and adding the dependency of ExtentReport v3.0.6+ is mandatory.

If you are not using maven, download the jar from here.

How to use?

Create a runner class and add the com.cucumber.listener.ExtentCucumberFormatter:output/report.html as a plugin followed by the report file as input (optional parameter).

A sample example is shown below:

package com.cucumber.runner;

import com.cucumber.listener.Reporter;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
import org.junit.AfterClass;
import org.junit.runner.RunWith;

import java.io.File;

/**
 * A sample test to demonstrate
 */
@RunWith(Cucumber.class)
@CucumberOptions(
    features = {"src/test/resources/features"},
    glue = {"com.cucumber.stepdefinitions"},
    plugin = {"com.cucumber.listener.ExtentCucumberFormatter:output/report.html"}
)
public class RunCukesTest {
    @AfterClass
    public static void teardown() {
        Reporter.loadXMLConfig(new File("src/test/resources/extent-config.xml"));
        Reporter.setSystemInfo("user", System.getProperty("user.name"));
        Reporter.setSystemInfo("os", "Mac OSX");
        Reporter.setTestRunnerOutput("Sample test runner output message");
    }
}

The above setup will generate the report in output directory with the name of report.html. There are 3 ways to configure the report location:

  • As shown above, pass the report file path along with com.cucumber.listener.ExtentCucumberFormatter:
  • If in case you want a dynamic location, you can leave the file path parameter empty while configuring the plugin. For example:
    plugin = {“com.cucumber.listener.ExtentCucumberFormatter:”}
    This will generate the report file in the location output/Run_/report.html.
  • You can also configure the report location by using ExtentProperties enum as follows. Leave the plugin configuration empty, and configure the report location in your @BeforeClass method:
    plugin = {"com.cucumber.listener.ExtentCucumberFormatter:"}
    ......
    ......
    @BeforeClass
    public static void setup() {
        ExtentProperties extentProperties = ExtentProperties.INSTANCE;
        extentProperties.setReportPath("output/myreport.html");
    }

The above example shows a JUnit runner. However, you can use the TestNG runner too. Refer more examples here.
Also make sure the loadXMLConfig, setSystemInfo and setTestRunnerOutput methods should be in your @AfterClass method.

Setting up ExtentX

The current release added a support for ExtentX. The results of your execution can be sent to ExtentX dashboard.

The ExtentX configurations can be set up using ExtentProperties enum as follows:

plugin = {"com.cucumber.listener.ExtentCucumberFormatter:"}
......
......
@BeforeClass
public static void setup() {
    ExtentProperties extentProperties = ExtentProperties.INSTANCE;
    extentProperties.setReportPath("output/myreport.html");
    extentProperties.setExtentXServerUrl("http://localhost:1337");
    extentProperties.setProjectName("MyProject");
}

You can either setup ExtentX in your local / remote machine using:
A docker approach – 2 minutes to setup
A plain vanilla approach

There are plenty of other configurations / features available. Kindly go through the documentation to understand in detail.

P.S: If you like this post, feel free to hit the Like button and share it.

152 Replies to “Cucumber Extent Reporter”

  1. Hi Vimal,

    Suppose we have more then 1 runner class and we have defined the cucumber extent report plugin in all runner class, then in this case the report is getting overwritten and the runner class executed last has report .

    So how we can merge reports together if we have more tan 1 runner class.

    1. Hi Abhigya,

      I would recommend generate the reports with unique names and build a logic at the end of the execution use the ExtentMerge to merge all the generated results.

      I know there is always we have many difficulties with the Cucumber when we execute in parallel or with many test runs. But we will have to live with workarounds. Let me know how it goes.

      1. Hi Vimal can you please let me know how to add the category section in the report for the Executed tags in the Cucumber feature file.

  2. Hi Vimal, getting below error –

    I have include yr dependency in pom.xml, add before class in stepdef file, add extent-config.xml in src/test/resource folder….please help how we can resolve this issue .

    java.lang.NoSuchMethodError: com.relevantcodes.extentreports.ExtentReports.addSystemInfo(Ljava/util/Map;)Lcom/relevantcodes/extentreports/ExtentReports;
    at com.cucumber.listener.ExtentCucumberFormatter.close(ExtentCucumberFormatter.java:219)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at cucumber.runtime.Utils$1.call(Utils.java:37)
    at cucumber.runtime.Timeout.timeout(Timeout.java:13)
    at cucumber.runtime.Utils.invoke(Utils.java:31)
    at cucumber.runtime.RuntimeOptions$1.invoke(RuntimeOptions.java:290)
    at com.sun.proxy.$Proxy12.close(Unknown Source)
    at cucumber.runtime.junit.JUnitReporter.close(JUnitReporter.java:213)
    at cucumber.api.junit.Cucumber.run(Cucumber.java:100)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

      1. Yes I am using v1.1.0 and build is getting failed –

        Tests in error:
        cignex.Deep.StepDefinition.TestRunner: com.relevantcodes.extentreports.ExtentReports.startTest(Ljava/lang/String;)Lcom/relevantcodes/extentreports/ExtentTest;
        cignex.Deep.StepDefinition.TestRunner: com.relevantcodes.extentreports.ExtentReports.addSystemInfo(Ljava/util/Map;)Lcom/relevantcodes/extentreports/ExtentReports;

    1. Never worked on Calabash, so I’m not a correct person to answer. I open this question to community so that someone will help you.

  3. Hi Vimal, i would like to attach each successful scrren end of the test method. Could you please guide me how to achieve using extentreports.
    regards
    sree

  4. Hi Vimal, I am using Cucumber and i have added version 1.1.0 in the POM.XML dependency is resolved. I have only added
    @RunWith(Cucumber.class)
    @CucumberOptions(plugin = {“com.cucumber.listener.ExtentCucumberFormatter”})
    public class RunCukesTest {

    }
    in the Cucumber runner file.
    It is throwing me NullPointer Exception.

    Can you please elaborate where all changes do i need to do to get the reports.

    Thanks
    Gaurav

  5. Hi Vimal,

    Thank you for this report, it is amazing. But i have a problem.
    When the report is completed, I can not see the “StepName” field, the visible fields are “Status” “Timestamp” “Details”.
    You can help me to resolve this?

    Thanks
    Duarte Ferreira

    1. Kindly open an issue in github link provided and attach the report with the sample project for me to reproduce the error. And BTW, what browser are you using?

  6. Hi Vimal,

    Even me also getting same issue which Duarte Ferreira is getting.
    Can you please help me out how to resolve this issue.

  7. Hi Vimal,

    Im getting below error

    java.lang.NoClassDefFoundError: freemarker/template/TemplateException
    at com.relevantcodes.extentreports.ExtentReports.(ExtentReports.java:85)
    at com.cucumber.listener.ExtentCucumberFormatter.initiateExtentCucumberFormatter(ExtentCucumberFormatter.java:59)
    at com.cucumber.listener.ExtentCucumberFormatter.initiateExtentCucumberFormatter(ExtentCucumberFormatter.java:104)
    at com.cucumber.listener.ExtentCucumberFormatter.initiateExtentCucumberFormatter(ExtentCucumberFormatter.java:110)
    at com.brady.mobiledyo.tests.RunnerTest.setUp(RunnerTest.java:50)
    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:515)
    at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:216)
    at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:143)
    at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:178)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
    at org.testng.TestRunner.privateRun(TestRunner.java:778)
    at org.testng.TestRunner.run(TestRunner.java:632)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:366)
    at org.testng.SuiteRunner.access$000(SuiteRunner.java:39)
    at org.testng.SuiteRunner$SuiteWorker.run(SuiteRunner.java:400)
    at org.testng.internal.thread.ThreadUtil$2.call(ThreadUtil.java:64)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    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)
    … 25 more

  8. I add this to my hooks page and it doesn’t recongize ExentCucumberFormatter.intiate…
    @BeforeClass
    public static void setup() {
    // Initiates the extent report and generates the output in the output/Run_/report.html file by default.
    ExtentCucumberFormatter.initiateExtentCucumberFormatter();
    }

  9. Report does not get generated for me. I have added this in the hooks class.
    @BeforeClass
    public static void setup() {
    // Initiates the extent report and generates the output in the output/Run_/report.html file by default.
    ExtentCucumberFormatter.initiateExtentCucumberFormatter();
    }

    Could you please help?

      1. This was with 1.1.1
        I upgraded to v2.41.1 to see if that would help but found no luck. The following is the code with v2.41.1
        // Initiates the extent report and generates the output in the output/Run_/report.html file by default.
        ExtentReports e = new ExtentReports(“src/test/resources/extent-config.xml”);

            // User can add the system information as follows
            e.addSystemInfo("Browser Name", "Firefox");
            e.addSystemInfo("Browser version", "v31.0");
            e.addSystemInfo("Selenium version", "v2.53.0");
        

  10. java.lang.NoClassDefFoundError: com/relevantcodes/extentreports/ExtentReports
    at com.cucumber.listener.ExtentCucumberFormatter.close(ExtentCucumberFormatter.java:228)
    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:498)
    I am getting this exception .
    can u plz tell me what is going wrong.
    thanks in advance.

  11. Hi Vimal,
    Its really a nice Reporting framework but I am getting following error when tried to run the Cucumber-runner:

    cucumber.runtime.CucumberException: Unrecognized plugin: com.seleniumtests.listner.ExtentCucumberFormatter

    at cucumber.runtime.RuntimeOptions$ParsedPluginData.addPluginName(RuntimeOptions.java:372)
    at cucumber.runtime.RuntimeOptions.parse(RuntimeOptions.java:125)
    at cucumber.runtime.RuntimeOptions.&lt;init&gt;(RuntimeOptions.java:85)
    at cucumber.runtime.RuntimeOptions.&lt;init&gt;(RuntimeOptions.java:78)
    at cucumber.runtime.RuntimeOptions.&lt;init&gt;(RuntimeOptions.java:70)
    at cucumber.runtime.RuntimeOptionsFactory.create(RuntimeOptionsFactory.java:25)
    at cucumber.api.junit.Cucumber.&lt;init&gt;(Cucumber.java:56)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104)
    at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86)
    at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
    at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
    at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
    

    My Runner class:

    @RunWith(Cucumber.class)
    @CucumberOptions(
    plugin = {“com.seleniumtests.listner.ExtentCucumberFormatter”},
    features = {“src/com/seleniumtests/resources”}
    ,format ={“pretty”, “html:target/cucumber-html-report”}
    ,glue={“com.seleniumtests.test”}
    ,tags = {“@Androidcalci”}

        )
    

    public class Runner {

    @BeforeClass
    public static void setup() {
        // Initiates the extent report and generates the output in the output/Run_&lt;unique timestamp&gt;/report.html file by default.
        ExtentCucumberFormatter.initiateExtentCucumberFormatter();
        // Loads the extent config xml to customize on the report.
        ExtentCucumberFormatter.loadConfig(new File("src/com/seleniumtests/resources/extent-config.xml"));
    
        // User can add the system information as follows
        ExtentCucumberFormatter.addSystemInfo("Browser Name", "Firefox");
        ExtentCucumberFormatter.addSystemInfo("Browser version", "v31.0");
        ExtentCucumberFormatter.addSystemInfo("Selenium version", "v2.53.0");
    
        // Also you can add system information using a hash map
        Map systemInfo = new HashMap();
        systemInfo.put("Cucumber version", "v1.2.3");
        systemInfo.put("Extent Cucumber Reporter version", "v1.1.1");
        ExtentCucumberFormatter.addSystemInfo(systemInfo);
    }
    

    }

      1. Hi

        Still its giving the same error:

        cucumber.runtime.CucumberException: Unrecognized plugin: com.seleniumtests.test.ExtentCucumberFormatter”

        I have tried on couple of desktops, with both Maven dependcies tried :

        com.vimalselvam
        cucumber-extentsreport
        1.1.1

          &lt;dependency&gt;
              &lt;groupId&gt;com.relevantcodes&lt;/groupId&gt;
              &lt;artifactId&gt;extentreports&lt;/artifactId&gt;
              &lt;version&gt;LATEST&lt;/version&gt;
          &lt;/dependency&gt;
        

        Kindly advise

        Thanks

        1. I would recommend you to raise an issue in the provided github link with your pom and other required sample for me to reproduce and help you on this problem.

  12. Hi Vimal,

    Its been wonderful working with the add-on and it is very much useful to us. Thanks a lot for your effort.
    We have one issue, where in the report is not getting saved with the screen shot, after the failure, system is taking the screen shot but the same is not appearing. We are just seeing the empty image.

    Can you please help on this.

    Once again thank you.

  13. Nice reporting.. Thanks a lot.
    Would like to know if is there any way to implement parallel execution in Cucumber framework. I am looking for a solution for parallel testing.

    1. Hi Vimal,

      Great tool.
      I am working on a framework which uses cucumber-jvm parallel for parallel execution. Is there a way to generate a single report with all test information.
      Thanks and regards,
      Karthik

      1. Yes this plugin is thread safe. So executing in parallel, will generate the single report with all test information. Kindly give a try and let me know how it goes. If you find any issues, kindly open a ticket in github.

  14. Hi Vimal,

    I have Feature file in the below format

    Feature: About Login Functionality

    Scenario Outline: Login Functionality
    Given user navigate to URL with excel row “row_index” dataset
    When user logs in using with excel row “” dataset
    And clicked on login button
    Then login should be successful

    Examples: 
      | row_index |
      |         1       |
    

    Based on the row_index, i have read the below data from excel workbook and pass into the step definition file
    URL UserName Password
    http://gmail.com/ venkaxxxxxx@gmail.com xxxxxxxxxx

    When i generate the cucumber extent report through runner before class, the report generating the below

    Given user navigate to URL with excel row “1” dataset
    When user logs in using with excel row “1” dataset

    My question is:

    is it possible to to print the input data into the Extent Report instead of row_index “1” like below

    Given user navigate to URL with excel row “http://gmail.com/” dataset

    Can you please help on this..

    Thanks,
    Venkat

  15. hi Vimal,

    Great reporting tool. Looks good too..

    I am working on a framework which uses cucumber-jvm parallel and my tests are executed in parallel.

    Can you please suggest if there is a way to implement to achieve a single report which consists of test results,logs and screen shot of parallel tests?

    Thanks and regards,
    Karthik

  16. Hi Vimal,

    I have a question here. I would like to know how can i generate pass/fail/info steps for the step definition methods.

    Note: My html file gets generated for the scenarios and features but when i need to validate any functionality in step definitions, i am unable to do so. Can you please share any sample code that would help here.

    Thanks In Advance,
    Phani Kanth

  17. Hi, I recently started using Extent Reporter for one of my BDD Project. In the final HTML Report that is generated, I couldn’t see the Datatables. only the steps are printed. Is there any special settings to display the Datatables.

    Thanks in advance,
    Kranthi

      1. Hi Vimal, Thanks for your quick response. I tried with the latest version i.e. 2.0.0 but still unable to view the data table in the steps displayed in the reports. Please find below a sample Scenario and the output displayed in the reports for your quick reference:

        Scenario: Successful Login with Valid Credentials
        Given User is on Home Page
        When User Navigate to LogIn Page
        And User enters Credentials to LogIn
        | testuser_1 | Test@153 |
        | testuser_2 | Test@264 |
        Then Message displayed Login Successfully

        Output displayed in Extent Report:

        TIMESTAMP STEPNAME DETAILS
        11:07:27 Given User is on Home Page PASSED
        11:07:27 When User Navigate to LogIn Page PASSED
        11:07:27 And User enters Credentials to LogIn PASSED
        11:07:27 Then Message displayed Login Successfully PASSED

        In Step 3 the databale is missing. Please advice.

        Regards,
        Kranthi

        1. Interesting… you have a data table for the step. The feature released will show data table only for the scenario outline.

          I’ll look into this tonight and update you.

        2. Kranthi, try the latest version of v2.0.1. The feature you have asked is now available. To view the data table of the step, you will have to click the step name.

  18. Hi Vimal,
    Would like to know if is there any way to implement parallel execution in Cucumber framework. I am looking for a solution for parallel testing.

    1. You will have to handle that in your @After hook. Something like this:

          @After
          public void afterHook(Scenario scenario) throws IOException {
              if (scenario.getStatus().equals(Result.FAILED)) {
                  // Add a step to take a screenshot and save it in a file
                  Reporter.addScreenCaptureFromPath("your path goes here");
              }
          }
      

      Hope this should help you.

        1. The above example should help you to take the screenshot. Not sure where you are stuck. Repeating again:

          Reporter.addScreenCaptureFromPath("your path goes here");
          
  19. Hey there! This is an incredible plugin for cucumber execution, and it happens to be the only “out of the box” solution I found to adding screenshots by step. One problem I’m having though is that my screenshots are appearing as broken image links. No matter what I try, I cannot get the actual screenshot to appear in the report. Do you have any ideas what may be causing this?

      1. Yes, this definitely saved my butt. It seems to be the only “out of the box” solution to embedding screenshots by step in a cucumber execution, which is a CRUCIAL thing to have in a regulated environment. Thanks!!!!

  20. Hi Vimal

    In my feature file every scenario corresponds to a separate test case. In the generated report, same count of test and steps is displayed.
    i want the count of test as the number of scenarios that are executed and not equal to the number of steps.
    And the the graph for steps shows some extra steps under info.
    can you please let me know what changes need to be done so that the test case pass fail count is reflected corresponding to scenario pass fail count and not gherkin step count

    1. Since extent considers all the parent nodes are tests and child nodes are steps, we see this issue. I’ll have to investigate more into this.

      1. And one more thing Vimal,in the step execution graph the count of the steps is more than that of actual step count.That extra step count is for info steps.
        Why is that included?

  21. Hi Vimal,
    I have few queries regarding the generated cucumber extent report:
    1. In the categories tab(second tab) of report, I have executed 1 feature file in which 2 scenarios passed and 6 scenarios failed, then why is the overall tag showing Passed:1
    2. Then the exceptions tab(third tab) shows only the exception occurred only in the last scenario and not shows the exceptions occurred in other failed scenarios.
    3. In the Dashboard tab(fourth tab) under categories chart again the Passed count is shown as 1, even though the scenario failed as a whole.

    can you please let me know why the pass count is updated even though the scenarios have failed.

  22. I have another quick question: I understand that this reporter is a runner extension, however if I am to add the screenshot in the step, if I simply run the feature file I will get errors regarding the add screenshot to reporter method. Do you know of any easy way to circumvent this error?

    1. You mean without the runner class? In that case, yes it will throw an error because the plugin is not loaded. This is expected.

      1. Hmmmmmm. Looks like I may have to write some kind of qualifier and conditional to handle running by feature versus running by runner. Thanks anyway!

        1. I’ll also research on this how it can be done. BTW when you say running feature directly, does it mean you are running from your IDE or through CLI?

          1. Through the IDE. I’m really just targeting the run configurations for individual feature files at this point, ensuring they don’t have a known error like this, so that my team can debug executions efficiently.

  23. I found my solution. I’m just passing in a system property from each type of execution, and calling a conditional to use the addScreenCaptureFromPath only if the executionType is “junit”.

    I have another question though…I can’t find anywhere information regarding what the content of the extent-config.xml should be, or what parameters can be used in that config file. Can you point me in the right direction? thanks!!!

  24. I’m running only 1 scenario which has 7 steps in it, however in the charts it shows
    5 test(s) passed
    1 test(s) failed, 2 others

    5 step(s) passed
    1 step(s) failed, 5 others

    What wrong I should be doing?

    1. You are doing it right. The report has to be updated for to support the BDD style which I’m currently working on. I’ll be releasing a new version in another few days which should solve this problem.

  25. Hi Vimal, I am trying to use extent reporting with cucumber-Junit(Maven)..I just followed the steps as mentioned above…

    When i run the suite, it throws an exception “cucumber.runtime.CucumberException: java.lang.NoClassDefFoundError: com/aventstack/extentreports/reporter/ExtentHtmlReporter”…

    Can you pls help?

  26. Reporter.addScreenCaptureFromPath(“Screenshot/”);

    -I’m unable to capture the screenshot using this method. Is there any other solution?

    Environment-MAC 10.12
    JAVA +JUNIT + cucumber

    1. The addScreenCaptureFromPath() method is not to capture the screenshot. It is intended to attach the captured screenshot in the report. You will have to use selenium way to capture the screenshot.

  27. Hi Vimal,

    While loading XML config, I get the below error

    [Fatal Error] :-1:-1: Premature end of file.
    Apr 27, 2017 10:05:21 AM com.aventstack.extentreports.configuration.ConfigLoader getConfigurationHash
    SEVERE: Config
    org.xml.sax.SAXParseException; Premature end of file.
    at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)

    I can see the config file created in the specified location but couldnt able to load it
    
    Here is the code
    
    @AfterClass
    public static void setup() throws IOException {
    
        File configFile = new File("src/test/java/Resources/extent-config.xml");
        configFile.createNewFile();
    
        Reporter.loadXMLConfig(configFile);
        Reporter.setSystemInfo("user", System.getProperty("user.name"));
        Reporter.setSystemInfo("os", "Mac OSX");
        Reporter.setTestRunnerOutput("Sample test runner output message");
        Reporter.addStepLog("Step Log message goes here");
    
    }
    
    Dependencies am using:
    
    &lt;dependency&gt;
    &lt;groupId&gt;com.vimalselvam&lt;/groupId&gt;
    &lt;artifactId&gt;cucumber-extentsreport&lt;/artifactId&gt;
    &lt;version&gt;2.0.4&lt;/version&gt;
    

    com.aventstack
    extentreports
    3.0.1

    Can you pls help?

  28. Hi Vimal, Do you have any idea about how to implement extent reporting for Jbehave like your cucumber one? I googled it but couldn’t find any relevant info…Can you please share me if you have any links how to start with it?

    1. I’ve already did some research around it, but didn’t made any progress. As you said, google didn’t help much. We’ll have to understand their execution lifecycle and the listeners available. This is one of my item in todo. I’ll let everyone know once I have something to release on it.

  29. Hi Vimal, Thank you for the nice reporting.. I am not getting category tab in report…not showing the count of how many features are passed/failed…I just followed the steps described above…am using the 3.0.5 for extentreports….2.0.4 for cucumber-extentsreport ..1.2.2 for cucumber-jvm.version …Can you please help me in how to get the category section?

  30. Hi Vimal,
    I’m trying to use ExtentX with Cucumber-JVM, does this library help me what i’m trying to achieve?
    appreciate your response.

    Thanks

  31. Hi Vimal,
    i’m using your library for cucumber extent reports, i am able to generate the reports but with some issues, instead of showing feature, scenario, steps count on the dashboard page it is showing tests and steps count like general TDD.any idea what could be the issue?

  32. Hi Vimal,
    Its a great plugin to use and appreciate your efforts.
    Can you please tell how to fail the step, if we should be using any junit assert statement? Tried all the assert statements, but nothing worked for me, every time it shows as Pass

  33. Hi Vimal,

    Its really great plugin and east to use, Thank you.

    however i missing to understand why its not appending existing reports of each run.

    i tried below statement

    Reporter.getExtentHtmlReport().setAppendExisting(true);

    any help much appreciated

    1. It should append to the existing report, kindly log an issue in the github repo with the code sample for me to reproduce. Also, try once with the latest version 3.0.0 before logging.

  34. I used the command within After hook.
    Reporter.addScreenCaptureFromPath(“your path goes here”);

    The screenshots are captured and saved at the specified location and I am passing the same path within Reported.addScreenCapturefrompath method. but the screenshots are not embedded in the extent report.

    how can i resolve this.

    1. Mr. Tester, kindly log an issue in the github repo with the code sample for me to reproduce the issue. I’ll have a look and try to help you.

  35. Hi Vimal,

    I am using maven cucumber,
    After every execution the new report overwrite the pervious report. I want every time it should generate new report with time stamp, not overwrite the previous report.

    Please advise
    Thanks
    Neer

    1. Neer, kindly update to the latest version v3.0.0 which has the feature to automatically generate the report with timestamp.

  36. Why there is no option of logging error in report. Just like we have Reporter.addstepLog, but we cannot log error so that it will display as an error in report in red?

    1. If your test throws an error, the error will be captured automatically. If you find an issue, kindly log an issue in the github repo.

  37. Hi Vimal,
    This is a great plugin and I appreciate your efforts.
    Can you please help me resolve the error described below:

    I am trying to use extent reporting with cucumber-Junit(Maven)

    My test runner class is:

    @RunWith(Cucumber.class)
    @CucumberOptions(features = {“src/test/resources/Feature/script1.feature”},

    plugin = {“json:BDDControlCenterTools/target/Reports/cucumber-report.json”,
    “com.cucumber.listener.ExtentCucumberFormatter:BDDControlCenterTools/target/Reports/cucumber-report.html”}
    )

    When I execute the code above its showing the runtime error message –

    cucumber.runtime.CucumberException: java.lang.NoClassDefFoundError: com/aventstack/extentreports/reporter/ExtentHtmlReporter

    As per your reply above, i added the extent report dependency in the pom xml but still no luck

                &lt;dependency&gt;
            &lt;groupId&gt;com.vimalselvam&lt;/groupId&gt;
            &lt;artifactId&gt;cucumber-extentsreport&lt;/artifactId&gt;
            &lt;version&gt;2.0.4&lt;/version&gt;
        &lt;/dependency&gt;
    

    Can you please help me to resolve this error. Thank you.

      1. Hi, thanks for your response.
        but, I already have the extent report dependency mentioned in the pom.xml in my script

        com.vimalselvam
        cucumber-extentsreport
        2.0.4

        Also, I have the cucumber-extentsreport-2.0.4.jar file under Maven dependencies.

        Do i have to add dependency anywhere else in my script ? Please give some light on this. Thanks!

        1. I got this issue resolved by removing all the dependencies and the jar files and then again adding the dependencies in the pom.xml and the jar files too. then I build the maven project and it worked file

  38. updated version of this library 2.0.5 doesn’t work for me, it throws below error :

    java.lang.ClassNotFoundException: com.aventstack.extentreports.gherkin.model.Given
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381).

    Also regarding report presentation.. for BDD it should display in the format of feature/scenario/steps but it displays only tests/step

  39. Hi Vimal, while I got my previous error resolved, I am seeing another Initialization error when I try to execute my runner class. The error message says –

    cucumber.runtime.CucumberException: Couldn’t load plugin class: com.cucumber.listener.ExtentCucumberFormatter

    I have the extent report dependencies in POM.xml and even I tried to change the JRE version and verified the compatible versions for JRE and JDK compliance.

                 &lt;dependency&gt;
            &lt;groupId&gt;com.relevantcodes&lt;/groupId&gt;
            &lt;artifactId&gt;extentreports&lt;/artifactId&gt;
            &lt;version&gt;2.41.2&lt;/version&gt;
        &lt;/dependency&gt;
    

    Can you please help to resolve this issue.

  40. Thanks Vimal for making it look like BDD reports. It works fine here.

    However, can we know when we’d be able to use filters?
    Also, I find a weird situation here. When I execute the tests from CLI maven command it works fine, however when I run it from feature file through IDE it give NPE at Reporter.addStepLog(message);

    1. Adding filters is the scope of Extent Report. Kindly raise an issue in the extent report github repo.
      Regarding running from IDE, how are you running? Are you right-click your feature and run? Because when you right click, the IDE generates the runner at run time without the plugin embedded. That may be the cause.

  41. Hi Vimal,

    Tried ExtentX today for my framework, there are some text display issues.
    when we click on a report, under details section all the characters of the text are getting displayed vertically.
    was trying to paste screenshot here for your information but i think its not supported here.

    Thanks,
    Yogiraj

  42. Hi Vimal,

    Great to hear that this plugin supports ExtentX now. Just wondering how do I specify ExtentX’s database details with this plugin?

  43. Hi Vimal,

    In the Setting up ExtentX section, the ExtentProperties only sets the url of ExtentX server, without any DB connection details. I think that might work if the ExtentX is installed locally. In my setup, ExtentX is installed in remote machine. Any advise?

      1. Thanks for the reply Vimal. Turned out the issue was that I was running with TestNG runner, and I had to initalise ExtentProperties enum on BeforeClass or BeforeSuite.

Leave a Reply