Reputation: 223
I'm experiencing following error, on trying to run CucumberJVM tests using Maven Reporting Mojo.
[INFO] --- maven-cucumber-reporting:0.0.5:generate (execution) @ testproject --- About to generate java.io.FileNotFoundException: /Users//IdeaProjects/testproject/target/cucumber.json (No such file or directory)
I have following dependencies in POM.xml file.
<dependency>
<groupId>net.masterthought</groupId>
<artifactId>maven-cucumber-reporting</artifactId>
<version>${maven.cucumber.reporting.version}</version>
</dependency>
<dependency>
<groupId>net.masterthought</groupId>
<artifactId>cucumber-reporting</artifactId>
<version>${cucumber.reporting.version}</version>
</dependency>
<dependency>
<groupId>com.googlecode.totallylazy</groupId>
<artifactId>totallylazy</artifactId>
<version>1077</version>
</dependency>
<dependency>
<groupId>com.beust</groupId>
<artifactId>jcommander</artifactId>
<version>1.25</version>
</dependency>
Repositories set to following.
<repositories>
<repository>
<id>repo.bodar.com</id>
<url>http://repo.bodar.com</url>
</repository>
<repository>
<id>sonatype-releases</id>
<url>https://oss.sonatype.org/content/repositories/releases/</url>
</repository>
</repositories>
Plugin set to following :
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.16</version>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
<plugin>
<groupId>net.masterthought</groupId>
<artifactId>maven-cucumber-reporting</artifactId>
<version>${maven.cucumber.reporting.version}</version>
<executions>
<execution>
<id>execution</id>
<phase>verify</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<projectName>${project.name}</projectName>
<outputDirectory>${project.build.directory}/cucumber-html-reports</outputDirectory>
<cucumberOutput>${project.build.directory}/cucumber.json</cucumberOutput>
<enableFlashCharts>false</enableFlashCharts>
</configuration>
</execution>
</executions>
</plugin>
I'm using Standard maven project structure, with feature files hosted in /src/test/resources, Step definitions under /src/test/main.
Would you please advise how to resolve this issue. I'm seeing this issue on MAC 64-bit OS.
Thanks in advance.
Best Regards, Raja
Upvotes: 3
Views: 10529
Reputation: 21
The plugin generates the HTML report from json. So the first step is to have cucumber generate the json.
When I ran into the same issue I found the cause of this the problem is that the cucumber.json file does not exist.
I addressed this in my project by adding json:target under the @CucumberOptions
annotation, this then generated the json. for example
@CucumberOptions(features = "src/test/resources/features/some.feature",
monochrome = false, format = {"pretty", "json:target/cucumber.json"})
The masterthought plugin then processes the generated JSON by looking for it at ${project.build.directory}/cucumber.json
At this point the Maven plugin generates the HTML from the JSON.
Upvotes: 2