2

I am not able to generate either a Cucumber report or a pretty html report.

Runner Class:
@CucumberOptions(
        features = "src/test/resources/Features",
        glue= {"stepDefinitions"},
        tags= {"@Report"},
        plugin= { "pretty",
                "html:target/site/cucumber-pretty",
        "json:target/cucumber.json" },
        monochrome = true

        )

public class TestRunner extends TestBase {



    private TestNGCucumberRunner testNGCucumberRunner;

    @BeforeClass(alwaysRun = true)
    public void setUpClass() throws Exception {
        testNGCucumberRunner = new TestNGCucumberRunner(this.getClass());
        System.out.println("Inside Set up method");
    }

     @Test(dataProvider = "features")
     public void feature(CucumberFeatureWrapper cucumberFeature) {
            testNGCucumberRunner.runCucumber(cucumberFeature.getCucumberFeature());
        }

     @DataProvider
        public Object[][] features() {
            return testNGCucumberRunner.provideFeatures();
        }


    @AfterClass(alwaysRun = true)
    public void tearDownClass() throws Exception {
        System.out.println("Inside teardown method");
        driver.quit();
    }
}

This is my pom.

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>Telstra-BDD</groupId>
  <artifactId>CucumberDemo</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>CucumberDemo</name>
  <url>http://maven.apache.org</url>

 <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <cucumber.version>1.2.5</cucumber.version>
  </properties>

<dependencies>
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-java</artifactId>
            <version>${cucumber.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
             <groupId>info.cukes</groupId>
             <artifactId>cucumber-core</artifactId>
             <version>${cucumber.version}</version>
        </dependency> 

        <dependency>
             <groupId>info.cukes</groupId>
             <artifactId>gherkin</artifactId>
              <version>2.12.2</version>
             <scope>provided</scope>
         </dependency>

        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-jvm-deps</artifactId>
            <version>1.0.3</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-testng</artifactId>
            <version>${cucumber.version}</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>junit</groupId>
                    <artifactId>junit</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>3.7.1</version>
        </dependency>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>6.11</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>net.masterthought</groupId>
            <artifactId>cucumber-reporting</artifactId>
            <version>3.8.0</version>
        </dependency>
    </dependencies>

    <build>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>3.0.2</version>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.6.1</version>
                <configuration>
                    <encoding>UTF-8</encoding>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.20</version>
                <configuration>
          <testFailureIgnore>true</testFailureIgnore>
          <includes>
            <exclude>**/*TestRunner.java</exclude>
          </includes>
        </configuration>
            </plugin>

            <plugin>
        <groupId>net.masterthought</groupId>
        <artifactId>maven-cucumber-reporting</artifactId>
        <version>2.0.0</version>
        <executions>
          <execution>
            <id>execution</id>
            <phase>verify</phase>
            <goals>
              <goal>generate</goal>
            </goals>
            <configuration>
              <projectName>cucumber-jvm-example</projectName>
              <outputDirectory>${project.build.directory}/site/cucumber-reports</outputDirectory>
              <cucumberOutput>${project.build.directory}/cucumber.json</cucumberOutput>
              <skippedFails>true</skippedFails>
              <enableFlashCharts>false</enableFlashCharts>
              <buildNumber>1</buildNumber>
            </configuration>
          </execution>
        </executions>
      </plugin>


        </plugins>
    </build>

</project>

Error I am getting is:

INFO] --- maven-cucumber-reporting:2.0.0:generate (execution) @ CucumberDemo ---
[INFO] About to generate Cucumber report.
java.lang.IllegalArgumentException: File 'C:\WorkspaceInfy\AutomationDemo\target\cucumber.json' does not contan features!
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:19 min
[INFO] Finished at: 2018-05-06T16:01:53+05:30
[INFO] Final Memory: 18M/231M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal net.masterthought:maven-cucumber-reporting:2.0.0:generate (execution) on project CucumberDemo: Error Found: BUILD FAILED - Check Report For Details -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Please somebody help.

4
  • 2
    What is the error that you're facing? – demouser123 May 6 '18 at 18:37
  • 1
    @demouser123 Error message is in there, but somewhat lost due to poor formatting. – Marit May 29 '18 at 19:15
  • Re-run the maven command to see the full stack trace which will give you a better understanding of the actual issue. – demouser123 May 30 '18 at 5:36
  • Note this was 2018 and user was one-off – Michael Durrant Mar 23 '19 at 18:36