Search

Sunday, 18 October 2015

Cucumber JVM: Advanced Reporting 3. Handling FileNotFound or Invalid JSON Errors

Cucumber JVM: Advanced Reporting 3. Handling FileNotFound or Invalid JSON Errors

Introduction

Since Advanced Cucumber JVM reporting was initially introduced and then enhancements were provided the most frequent question was related to the error when input file was not found or it was improperly formatted. Normally such error was accompanied with the output like:

java.io.IOException: Input is invalid JSON; does not start with '{' or '[', c=-1
 at com.cedarsoftware.util.io.JsonReader.readJsonObject(JsonReader.java:1494)
 at com.cedarsoftware.util.io.JsonReader.readObject(JsonReader.java:707)
 at com.github.mkolisnyk.cucumber.reporting.CucumberResultsOverview.readFileContent(CucumberResultsOverview.java:81)
 ...
or
java.io.FileNotFoundException
 at com.github.mkolisnyk.cucumber.reporting.CucumberResultsOverview.readFileContent(CucumberResultsOverview.java:76)
 at com.github.mkolisnyk.cucumber.reporting.CucumberResultsOverview.executeFeaturesOverviewReport(CucumberResultsOverview.java:189)
 ...
As it is one of the most frequent questions I decided to create separate post explaining reasons of it and the way to fix.

Major reasons of problem

There are a few reasons why such errors appear. Mainly they are:

  • Report generation is called before the source report is generated
  • Report generation is targeted to wrong report location
Let's take a closer look at all of those items.

Report generation is called before the source report is generated

Some people try to add report generation as the part of hooks or other post-actions which are mainly annotated with @After, @AfterClass or similar annotations. If you use any form of hooks or built-in post-actions you should know 2 major things:

  1. Cucumber runner doesn't call default JUnit Before- and After- methods - that's why there are some pre-defined hooks with custom annotations for that.
  2. Cucumber Reporting solution uses reports generated after entire Cucumber suite run completes including post-condition events - it means that if you add report generation code into @After method the required input file may even appear but it wouldn't be populated with the data yet. Data will appear when Cucumber completes it's execution entirely.
So, in order to generate Advanced Cucumber reports properly
DO NOT add report generation instructions into hooks or any other standard after-methods.

Report generation is targeted to wrong report location

In some cases we may use improper references for files. E.g. we have our Cucumber class like:

@RunWith(Cucumber.class)
@CucumberOptions(plugin = { "html:target/cucumber-html-report",
        "json:target/cucumber.json", "pretty:target/cucumber-pretty.txt",
        "usage:target/cucumber-usage.json",
        "junit:target/cucumber-results.xml"
        },
        features = { "./src/test/java/com/github/mkolisnyk/cucumber/features" },
        glue = { "com/github/mkolisnyk/cucumber/steps" },
        tags = {"@consistent"})
public class SampleCucumberTest {
}
and then somewhere we generate detailed report like:
        CucumberDetailedResults results = new CucumberDetailedResults();
        results.setOutputDirectory("target/");
        results.setOutputName("cucumber-results-width");
        results.setSourceFile("./src/test/resources/cucumber.json");
        results.setScreenShotLocation("../src/test/resources/");
        results.setScreenShotWidth("200px");
        results.executeDetailedResultsReport(true, false);
The highlighted fragments of code should point to the same location. Otherwise we either have FileNotFoundException or wrong report generated at all.

Major Checkpoints and Resolution

So, what do we need to overcome all those problems? There are several steps you should go through to make sure that you include reporting in proper way.

Make sure you use proper reporting library version

New features are always to come and versions are updated as soon as some certain number of implemented features is implemented. At the moment when this post is being written the current version is 0.0.11 and it can be included as Maven dependency using the following construction:

<dependency>
    <groupId>com.github.mkolisnyk</groupId>
    <artifactId>cucumber-reports</artifactId>
    <version>0.0.11</version>
</dependency>
or Gradle dependency:
'com.github.mkolisnyk:cucumber-reports:0.0.11'
Also, you can find the latest version of the reporting library in the Maven Central repository via any available web viewers, e.g. at search.maven.org or at mvnrepository.org.

Use extended Cucumber reporting functionality

The library itself includes Cucumber runner extension which includes reports generation at proper time. Here is the example of Extended Cucumber runner use:

import org.junit.runner.RunWith;

import com.github.mkolisnyk.cucumber.runner.ExtendedCucumber;
import com.github.mkolisnyk.cucumber.runner.ExtendedCucumberOptions;

import cucumber.api.CucumberOptions;

@RunWith(ExtendedCucumber.class)
@ExtendedCucumberOptions(jsonReport = "target/cucumber.json",
        retryCount = 3,
        detailedReport = true,
        detailedAggregatedReport = true,
        overviewReport = false,
        toPDF = false,
        outputFolder = "target")
@CucumberOptions(plugin = { "html:target/cucumber-html-report",
        "json:target/cucumber.json", "pretty:target/cucumber-pretty.txt",
        "usage:target/cucumber-usage.json",
        "junit:target/cucumber-results.xml"
        },
        features = { "./src/test/java/com/github/mkolisnyk/cucumber/features" },
        glue = { "com/github/mkolisnyk/cucumber/steps" },
        tags = {"@consistent"})
public class SampleCucumberTest {
}
So, in case of such extension use we make sure we have our reports processing done at the moment when standard Cucumber reports have already been generated.

Make sure both CucumberOptions and ExtendedCucumberOptions refer to the same report files

Advanced reporting is mainly about Cucumber standard reports post-processing so we should make consistent reference between values in CucumberOptions and ExtendedCucumberOptions annotations. Mainly it's about JSON file paths as for CucumberOptions it is output file while ExtendedCucumberOptions annotation utilizes this file as an input file.

Additionally, make sure that

Usage report operates with the output file different from the one required by other reports. Also, usage report is not generated for dry runs.
So, pay attention which files you refer to.

Summary

By following the above rules and getting basic understanding of how this solution works we can mitigate a lot of silly problems. Also, the Cucumber Reporting Documentation pages are available and they will be populated as soon as new features arrive. So, you can refer to it as well.

38 comments:

  1. Hi, I am already using test runner (CucumberWithSerenity.class); So I do not want to use another test runner (ExtendedCucumber.class). So how do I use this report generation plugin?

    ReplyDelete
    Replies
    1. In this case you can extend CucumberWithSerenity runner where at the end you can put the code which generates report. You can take a look at the ExtendedCucumber implementation and the run method in particular. You can do similar thing for the runner you like as the ExtendedCucumber is also just wrapper above standard Cucumber runner class.

      Delete
    2. Thanks Nickolay! I tried what you said; might solve my issue. But I am having another issue now. Adding this dependency to pom messes with my maven-failsafe-plugin which reports as 0 tests run.


      com.github.mkolisnyk
      cucumber-reports
      1.0.0


      Output of mvn clean verify gives the following output, when actually 117 tests have been run and passed. It used to report 117 before.

      Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 164.901 sec - in appstranet.cucumber.SmokeTestSuite

      Results :

      Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

      I tried to move around the dependency within pom, but still not solved the issue.
      Any help is appreciated.

      Delete
    3. Thanks Nickolay! I tried what you said; might solve my issue. But I am having another issue now. Adding this dependency to pom messes with my maven-failsafe-plugin which reports as 0 tests run.


      com.github.mkolisnyk
      cucumber-reports
      1.0.0


      Output of mvn clean verify gives the following output, when actually 117 tests have been run and passed. It used to report 117 before.

      Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 164.901 sec - in appstranet.cucumber.SmokeTestSuite

      Results :

      Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

      I tried to move around the dependency within pom, but still not solved the issue.
      Any help is appreciated.

      Delete
    4. 99% this happens because this maven-failsafe-plugin uses TestNG by default. So, the run stats you see is just the result of TestNG runs for JUnit tests which is obviously 0.

      I encountered the same problem with maven-surefire-plugin and I solved it by adding extra dependency. You can find the solution description in related post. As I remember the maven-failsafe-plugin is some kind of extension for maven-surefire-plugin, so the solution should be of the similar nature. At least, you should dig in that direction.

      Delete
  2. Hi Nikolay,

    I’m using your ExtendedCucumber runner, but I got following error:

    Exception in thread "main" java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal
    at java.lang.ClassLoader.defineClass1(Native Method)

    at com.github.mkolisnyk.cucumber.reporting.CucumberResultsOverview.executeOverviewReport(CucumberResultsOverview.java:159)


    It look like issue with xml-apis library. Any help is appreciated.

    ReplyDelete
    Replies
    1. Hi Marek,

      This looks very similar to the conflicting versions of xml-apis library. It may be taken as the dependency in several places and we can get such error. Apparently, if you add explicit dependency on xml-apis of version 1.4.01 this should help.

      Here is the grade script fragment of one of my project showing how to sort out with those dependencies (and it works):

      compile ('com.github.mkolisnyk:cucumber-reports:1.0.1') {
      exclude group: 'xml-apis'
      }
      compile 'xml-apis:xml-apis:1.4.01'

      If you use Maven apply changes appropriately. Just note the exclude group statement. If simply excludes all entries of xml-apis in cucumber-reports library dependency. And next statement adds this library explicitly of proper version.

      Delete
  3. You can give me a example, where I can put the next code:

    CucumberResultsOverview results = new CucumberResultsOverview();
    results.setOutputDirectory("target");
    results.setOutputName("LoginReport");
    results.setSourceFile("target/Login.json");
    results.executeFeaturesOverviewReport();

    I not understand where I can put it to is execute.

    ReplyDelete
    Replies
    1. This portion of code should be placed into the module which is supposed to be invoked after entire Cucumber test suite run is done and reports are generated. But if you don't use any customisation for your Cucumber I'd suggest using ExtendedCucumberRunner. Actually, see Use extended Cucumber reporting functionality section of the above post to find example

      Delete
  4. I have a new problem :(, the chatrs actually in not show; I an using the overviewReport

    ReplyDelete
    Replies
    1. This looks like an issue. Please, address your problem to the GitHub repository which is located here: https://github.com/mkolisnyk/cucumber-reports/issues/

      In the issues details please provide the report, problem description and if possible any additional information as "charts in not show" is too high level information. I'd like to know how to reproduce it. In this area your help would be much appreciated

      Delete
    2. Here https://github.com/mkolisnyk/cucumber-reports/issues/63, is created the issue

      Delete
  5. This comment has been removed by the author.

    ReplyDelete
  6. When I implemented @RunWith(Extended Cucumber.class), this created a branch "Unrooted Test", when I execute my Scenarios, it have backgroung steps and Scenarios Outline. I read and says that this happens when the test is trying run with JUnit 4, I belive that you have implemented JUnit 3

    ReplyDelete
    Replies
    1. With my library I'm using JUnit 4. And I'm using the features of JUnit 4, not earlier versions. All my examples written in my posts are based on JUnit 4. So, I wonder what is the way you are trying to run your tests. The thing is that if you use some Cucumber built-in tools the final behavior may be different from any other ways of running those tests

      Delete
    2. They are the dependencies that I used


      maven-compiler-plugin
      3.1

      1.8
      1.8






      net.sourceforge.cobertura
      cobertura
      2.1.1


      info.cukes
      cucumber-android
      1.2.0


      info.cukes
      cucumber-core
      1.2.4


      info.cukes
      cucumber-html
      0.2.3


      info.cukes
      cucumber-java
      1.2.4


      info.cukes
      cucumber-junit
      1.2.4


      info.cukes
      cucumber-jvm-deps
      1.0.5


      info.cukes
      cucumber-picocontainer
      1.2.4


      org.uniknow.agiledev
      cucumber-reporting
      0.1.8


      info.cukes
      gherkin
      2.12.2


      junit
      junit
      4.12


      org.mockito
      mockito-all
      1.10.19


      org.picocontainer
      picocontainer
      2.2


      io.appium
      java-client
      3.2.0


      org.seleniumhq.selenium
      selenium-java
      2.47.1


      log4j
      log4j
      1.2.17


      postgresql
      postgresql
      9.1-901-1.jdbc4


      com.oracle
      ojdbc14
      10.2.0.4.0


      com.github.mkolisnyk
      cucumber-reports
      0.0.11


      com.sun
      tools
      1.6
      system
      C:\Program Files\Java\jdk1.8.0_60\lib\tools.jar


      Delete
    3. OK. As I can see I'm using the same version of JUnit and Cucumber libraries. BTW, the cucumber-reports library now has the latest version of 1.0.1, so just in case, make sure you updated it.
      As for unrooted tests node, that can be resulted by improper CucumberOptions settings or improperly formatted feature file. But I could take a closer look at it if I had a chance to see the feature file and JUnit test class. If any you can create a new issue in the GitHub project. Here is the link: https://github.com/mkolisnyk/cucumber-reports/issues

      Delete
    4. Here https://github.com/mkolisnyk/cucumber-reports/issues/62, is a created issue

      Delete
  7. I want to understand the known errors report better. Is the idea to supply a list of failing scenarios names and what? highlight them in the report differently?

    ReplyDelete
  8. Is there any way this can be used with Cucumber weld?
    I.e:

    info.cukes
    cucumber-weld
    1.2.4
    test

    ReplyDelete
  9. Hi Nicolay

    Can this be done as part of an ant build process? if so could you give me some pointers to how I can do this? in the meantime i'll keep trying

    Cheers

    Rich

    ReplyDelete
    Replies
    1. The runner itself is simply another Unit runner. So, in Ant it can be triggered the same way as any other Unit tests. The biggest difficulty is that you need to include cucumber-reports library Jar with all dependencies unless there's some way to resolve remote dependencies from Ant

      Delete
  10. Hi Nickolay Kolesnik,

    I am getting below the error, though i have targeted the Report generation location to correct report location. Please find below the piece of code
    IOException: Input is invalid JSON; does not start with '{' or '[', c=-1 at ... readJsonObject(JsonReader.java:1494)

    @CucumberOptions(
    strict = false,
    features = "src/test/resources/feature/",
    glue={"com.telstra.selenium"},
    dryRun=false,
    tags={"@Sanity"},
    monochrome=true,
    plugin = {"html:target/cucumber","json:target/cucumber.json", "pretty:target/cucumber-pretty.txt",
    "usage:target/cucumber-usage.json", "junit:target/cucumber-results.xml"}
    )


    CucumberResultsOverview results = new CucumberResultsOverview();
    results.setOutputDirectory("target");
    results.setOutputName("target/cucumber-results");
    results.setSourceFile("target/cucumber.json");
    results.executeFeaturesOverviewReport();

    And,
    POM.xml file:


    cucumber-jvm-example
    ${project.build.directory}/site/cucumber-reports
    ${project.build.directory}/cucumber.json
    true
    false
    42

    ReplyDelete
    Replies
    1. Hi Venkata,

      You checked just one potential reason of the error but you didn't check another one which is: Report generation is called before the source report is generated. And this is very likely the case.

      Solution: You can read about it exactly in this post you commented for. Just find the heading Use extended Cucumber reporting functionality with some sample code

      Delete
  11. Hi Nickolay, I am using cucumber with TestNg. I am using ExtendedCucumberOptions as advised above for the overall report and added all the necessary jars. I have given the destination as target. I am not able to see any of the reports in the target and there is no issue reported while running the test related to reports. Please advise on how to go about it. Thanks in advance

    ReplyDelete
    Replies
    1. There may be multiple reasons. I'd suggest firstly to make sure that ExtendedCucumberOptions refers to the same JSON file as defined by standard CucumberOptions.

      After that make sure you have flag overviewReport = true set in ExtendedCucumberOptions. If you don't have any of the reporting flags set to true we should hardly expect that anything would ever be generated.

      Another checkpoint is the actual path where reports are generated to. This folder should exist. Also, since the path is relative, make sure that you run tests from the folder you actually expect to be the root folder.

      Additionally, try to refresh folder content. Maybe reports aren't seen just because folder content wasn't refreshed in IDE or whatever you browse content by

      Delete
  12. Hi Nickolay,

    I am getting

    org.apache.maven.reporting.MavenReportException: Error occured while generating Cucumber usage report
    at com.github.mkolisnyk.cucumber.reporting.CucumberUsageReporting.executeReport(CucumberUsageReporting.java:385)
    at com.khurana.Test.Test1.tearDown(Test1.java:70)
    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 cucumber.runtime.Utils$1.call(Utils.java:40)
    at cucumber.runtime.Timeout.timeout(Timeout.java:16)
    at cucumber.runtime.Utils.invoke(Utils.java:34)
    at cucumber.runtime.java.JavaHookDefinition.execute(JavaHookDefinition.java:60)
    at cucumber.runtime.Runtime.runHookIfTagsMatch(Runtime.java:224)
    at cucumber.runtime.Runtime.runHooks(Runtime.java:212)
    at cucumber.runtime.Runtime.runAfterHooks(Runtime.java:206)
    at cucumber.runtime.model.CucumberScenario.run(CucumberScenario.java:46)
    at cucumber.runtime.junit.ExecutionUnitRunner.run(ExecutionUnitRunner.java:102)
    at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:63)
    at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:18)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at cucumber.runtime.junit.FeatureRunner.run(FeatureRunner.java:70)
    at cucumber.api.junit.Cucumber.runChild(Cucumber.java:95)
    at cucumber.api.junit.Cucumber.runChild(Cucumber.java:38)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    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:459)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
    Caused by: java.io.IOException: Input is invalid JSON; does not start with '{' or '[', c=-1
    at com.cedarsoftware.util.io.JsonReader.readJsonObject(JsonReader.java:1494)
    at com.cedarsoftware.util.io.JsonReader.readObject(JsonReader.java:707)
    at com.github.mkolisnyk.cucumber.reporting.CucumberUsageReporting.getStepSources(CucumberUsageReporting.java:340)
    at com.github.mkolisnyk.cucumber.reporting.CucumberUsageReporting.executeReport(CucumberUsageReporting.java:366)
    ... 38 more

    Also I want to know where should

    CucumberUsageReporting report = new CucumberUsageReporting();
    report.setOutputDirectory("target");
    report.setJsonUsageFile("target/cucumber-report.json");
    report.executeReport();
    be put?

    ReplyDelete
    Replies
    1. You are getting exactly the same error as this post describes about. So, the answer to your question (where to put this code fragment) is: nowhere. Use Extended Cucumber Runner. It's a wrapper on standard Cucumber-JVM runner with some additions related to reporting in particular. So, read this post and the link I gave to see examples.

      Delete
  13. The issue "Input is invalid JSON; does not start with '{' or '[', c=-1" can be resolved by having the following code snippet in @AfterClass Junit method in the cucumber runner file.

    Runtime.getRuntime().addShutdownHook(new Thread() {
    @Override
    public void run() {

    String sourcePath = System.getProperty("user.dir") + File.separator + "//target//cucumber.json";

    CucumberDetailedResults pdfResult = new CucumberDetailedResults();
    pdfResult.setOutputDirectory(System.getProperty("user.dir") + File.separator + "target//");
    pdfResult.setOutputName(new SimpleDateFormat("MM_dd_yyyy").format(new Date(System.currentTimeMillis())));
    pdfResult.setSourceFile(sourcePath);

    try {

    pdfResult.execute(true,true);

    } catch (Exception e) {

    e.printStackTrace();

    }

    }

    Note:
    Make sure that @Before in Hooks.java does not generate the report.

    -Thanks

    ReplyDelete
    Replies
    1. That's interesting. I still recommend using ExtendedCucumberRunner but this definitely looks like some quick alternative

      Delete
    2. I tried using ExtendedCucumberRunner. But didn't resolve that Invalid JSON issue.

      Delete
    3. If you use the ExtendedCucumberRunner you no longer need to write the code generating report explicitly. Extended runner already has it. The only thing you should care about is references to proper JSON file. Look at the sample code in this post (the last example).

      Delete
  14. Hello Nickolay,

    Thanks for such a great tutorial.

    I am facing an issue -
    In my framework we have 20 feature files and each file has a runner file which will be running in parallel using maven sure fire plugin.

    However the problem I am facing is I have give cucumber.json in each of the runner file and expecting that I will have a one consolidated json file while will be used for report generation.

    But when ever the scenarios are running they are overwriting the json file. And in the end I just have report foe the last feature file executed.

    Is there any way the results in json file can be concatenated to the previous scenario results after the scenario execution.

    Please help me.

    Thanks,
    Sundeep

    ReplyDelete
    Replies
    1. For TestNG that can be done in 2 steps:

      1) each runner class performs output to different JSON file. Thus no output files would be overridden

      2) There should be method which is called after entire test suite ends (TestNG should have such support). In this method you can generate reports using API. E.g. for the detailed report it looks like this:

      CucumberDetailedResults results = new CucumberDetailedResults();
      results.setOutputDirectory("target/");
      results.setOutputName("cucumber-results");
      results.setSourceFiles(new String[] {
      "./src/test/resources/cucumber.json",
      "./src/test/resources/cucumber-2.json"
      });
      results.setScreenShotWidth("300px");
      results.execute(true, true);

      Pay attention to the setSourceFiles method. It accepts array of paths to multiple JSON files. This way you can combine multiple outputs and report them in a single file.

      Delete
  15. Hi,
    i am using following settings:
    build.gradle
    testCompile group: 'org.springframework.boot', name: 'spring-boot-starter-test', version: '1.5.4.RELEASE'
    compile group: 'net.sf.supercsv', name: 'super-csv', version: '2.4.0'
    compile group: 'info.cukes', name: 'cucumber-java', version: '1.2.5'
    compile group: 'info.cukes', name: 'cucumber-core', version: '1.2.5'
    compile group: 'info.cukes', name: 'gherkin', version: '2.12.2'
    testCompile group: 'org.slf4j', name: 'slf4j-simple', version: '1.6.1'
    testCompile group: 'info.cukes', name: 'cucumber-spring', version: '1.2.5'
    testCompile group: 'info.cukes', name: 'cucumber-junit', version: '1.2.5'
    compile group: 'com.github.mkolisnyk', name: 'cucumber-report-generator', version: '1.0.11'
    }

    and
    package cucumberJava.runners;

    import com.github.mkolisnyk.cucumber.runner.ExtendedCucumberOptions;

    import cucumber.api.CucumberOptions;
    import cucumber.api.junit.Cucumber;
    import org.junit.runner.RunWith;

    /**
    * The JUnit runner uses the JUnit framework to run the Cucumber Test.
    * All we need is to create a single empty class with an annotation @RunWith(Cucumber.class
    * Created by vpathani on 14/08/2017.
    */

    @RunWith(ExtendedCucumber.class)
    @ExtendedCucumberOptions(jsonReport = "target/cucumber.json",
    retryCount = 3,
    detailedReport = true,
    detailedAggregatedReport = true,
    overviewReport = false,
    toPDF = false,
    outputFolder = "target")
    @CucumberOptions(
    format = {"pretty"},
    tags = {"@passed"},
    glue = "cucumberJava.steps" ,
    features = "src/test/resources/cucumber",
    plugin = { "html:target/cucumber-html-report",
    "json:target/cucumber.json", "pretty:target/cucumber-pretty.txt",
    "usage:target/cucumber-usage.json", "junit:target/cucumber-results.xml" }
    )
    public class RunGwMLCompareTests {

    }
    but i not able to find extendedRunner class any help.

    ReplyDelete
    Replies
    1. You will not find this class there because you include wrong dependency. Try to include cucumber-report-runner instead of cucumber-report-generator

      Delete
    2. Hi Nickolay,
      Thanks for your help its working now. I do have one more question, is there any way i can add data in report:
      Like I have following Step in java class:-
      @Then("^(.+) validateEqual (.+)$")
      public void validateEqual(String gwmlColName, String smartColName) throws Throwable {
      for (Map.Entry> value : comparisonResultMap.entrySet()) {
      Map resultMap = value.getValue();
      String gwmlColValue = resultMap.get(gwmlColName);
      String smartColValue = resultMap.get(smartColName);
      try{
      assertEquals(gwmlColValue,smartColValue);
      }catch(Throwable e){
      System.out.println(" Caught Exception ");
      throw new PendingException(e.getMessage());
      }
      }
      }
      As you can i am running same step in loop and i want to populate data (gwmlColValue ,smartColValue ) in report under this step. Is there some way this can be achived in Cucumber.
      Any help is greatly appreciated.
      Regards,
      Vikram Pathania

      Delete