在尝试使用Maven Reporting Mojo运行CucumberJVM测试时,我遇到了以下错误。
信息--maven-cucumber-reporting:0.0.5:生成(执行)@ /Users//IdeaProjects/testproject/target/cucumber.json -即将生成java.io.FileNotFoundException: testproject (没有这样的文件或目录)
我在POM.xml文件中有以下依赖项。
<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>
<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>插件设置如下:
<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>我使用的是Standard maven项目结构,特性文件托管在/src/test/resources中,步骤定义在/src/test/main下。
你能建议一下如何解决这个问题吗?我在MAC 64位操作系统上看到了这个问题。
提前谢谢。
致以最好的问候,Raja
发布于 2014-06-11 02:32:07
该插件从json生成HTML报告。因此,第一步是让cucumber生成json。
当我遇到同样的问题时,我发现问题的原因是cucumber.json文件不存在。
我在我的项目中解决了这个问题,在@CucumberOptions注释下添加了json:target,这将生成json。例如
@CucumberOptions(features = "src/test/resources/features/some.feature",
monochrome = false, format = {"pretty", "json:target/cucumber.json"})然后,masterthought插件通过在${project.build.directory}/cucumber.json中查找生成的JSON来处理它
此时,Maven插件从JSON生成HTML。
https://stackoverflow.com/questions/23893928
复制相似问题