首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Maven黄瓜报告故障- Java.io.FilenotFound exception cucumber.json

Maven黄瓜报告故障- Java.io.FilenotFound exception cucumber.json
EN

Stack Overflow用户
提问于 2014-05-27 23:59:14
回答 1查看 7.9K关注 0票数 3

在尝试使用Maven Reporting Mojo运行CucumberJVM测试时,我遇到了以下错误。

信息--maven-cucumber-reporting:0.0.5:生成(执行)@ /Users//IdeaProjects/testproject/target/cucumber.json -即将生成java.io.FileNotFoundException: testproject (没有这样的文件或目录)

我在POM.xml文件中有以下依赖项。

代码语言:javascript
复制
<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>

存储库设置为以下。

代码语言:javascript
复制
<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>

插件设置如下:

代码语言:javascript
复制
 <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

EN

回答 1

Stack Overflow用户

发布于 2014-06-11 02:32:07

该插件从json生成HTML报告。因此,第一步是让cucumber生成json。

当我遇到同样的问题时,我发现问题的原因是cucumber.json文件不存在。

我在我的项目中解决了这个问题,在@CucumberOptions注释下添加了json:target,这将生成json。例如

代码语言:javascript
复制
@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。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/23893928

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档