当使用黄瓜编写测试时,Maven surefire报告的文件名具有冗余空间

时间:2013-08-20 12:05:33

标签: maven-surefire-plugin cucumber-junit

我正在使用maven-surefire-plugin版本2.16以及使用黄瓜编写的测试。 .xml和.txt报告确实可以在sure-fire reports文件夹中找到。 .xml和.txt文件中的文本以及名称具有许多额外的空格,这些空格与累积执行的步骤定义的数量成比例。文件名还有一些与执行步数成比例的空格。如果我运行了很多测试,那么文件根本不会保存以下异常

[错误]无法在项目 ** 上执行目标org.apache.maven.plugins:maven-surefire-plugin:2.16:test(default-test): 执行default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.16:test failed:org.apache.maven.surefire.util.NestedRuntimeException:null; 嵌套异常是org.apache.maven.surefire.report.ReporterException: 无法为报告创建文件:/ Users / kgupta2 / git / $$$$$$$$ / target / surefire-reports / Scenario:使用$$$$$ .txt(文件名太长); 嵌套异常是java.io.FileNotFoundException:/ Users / kgupta2 / git / $$$$$$$$ / target / surefire-reports / Scenario:使用$$$$$$$$ .txt(文件名太长) - > [帮助1] [ERROR]

[错误]要查看错误的完整堆栈跟踪,请使用-e开关重新运行Maven。

[错误]使用-X开关重新运行Maven以启用完整的调试日志记录。

[ERROR]

[错误]有关错误和可能解决方案的更多信息,请阅读以下文章:

[错误] [帮助1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException

显然文件名变长,我已经确认它与执行的步数成正比。我正在使用JUnit运行黄瓜。

这是我对maven-surefire-plugin的配置

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.16</version>
<configuration>
    <testSourceDirectory>${project.basedir}/src/test/java</testSourceDirectory>
    <includes>
        <include>**/CucumberJunitRun.java</include>
    </includes>
</configuration>
<dependencies>
    <dependency>
        <groupId>org.apache.maven.surefire</groupId>
        <artifactId>surefire-junit47</artifactId>
        <version>2.16</version>
    </dependency>
</dependencies>
</plugin>

我无法理解为什么会弹出这些额外的空格。

1 个答案:

答案 0 :(得分:0)

我让这个工作。这是插件配置错误的问题。因为我使用JUnit来运行我的黄瓜测试,所以我继续从我的pom中删除了所有TestNG的引用,这让它神奇地工作。 TestNG的一些参考资料来自我父母的pom。刚检查一下我的有效pom是否依赖于testNG。真的没有一个很好的线索,为什么会发生这种情况。但正确的配置修复了一堆其他错误,这些错误正在悄悄进行中