【问题标题】:pitest - PIT requires either JUnit 4 (but can run JUnit 3 tests) or TestNGPitest - PIT 需要 JUnit 4(但可以运行 JUnit 3 测试)或 TestNG
【发布时间】:2017-03-30 11:48:03
【问题描述】:

我正在尝试使用 ptest 在 Apache Airavata (v0.16) 上应用突变测试。我在 build plugins 标签下的 pom.xml 文件中添加了以下几行:

<plugin>
    <groupId>org.pitest</groupId>
    <artifactId>pitest-maven</artifactId>
    <version>1.1.11</version>
 </plugin>

它给了我以下错误。

[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.012 s
[INFO] Finished at: 2017-03-30T14:27:44+03:00
[INFO] Final Memory: 21M/212M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.pitest:pitest-maven:1.1.11:mutationCoverage (default-cli) on project airavata-server-configuration: Execution default-cli of goal org.pitest:pitest-maven:1.1.11:mutationCoverage failed: No test library found on classpath. PIT requires either JUnit 4 (but can run JUnit 3 tests) or TestNG
[ERROR] See http://pitest.org for more details.
[ERROR] -> [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/PluginExecutionException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :airavata-server-configuration

我没有 TestNG,但 junit4 路径包含在 CLASSPATH 中。我尝试提供以下一些有针对性的测试用例,但它也不起作用。

<plugin>
    <groupId>org.pitest</groupId>
    <artifactId>pitest-maven</artifactId>
    <version>1.1.11</version>
    <configuration>
        <targetTests>
            <param>org.apache.archiva.common.utils*</param>
        </targetTests> 
    </configuration>
</plugin>

我也尝试了以下标签,但它根本没有帮助。

<failWhenNoMutations>false</failWhenNoMutations>

【问题讨论】:

    标签: maven junit pom.xml junit4 pitest


    【解决方案1】:

    Archiva 似乎包含许多不包含源代码或测试的模块。

    pitest 1.1.12 版本将自动跳过这些(请参阅314),但在此版本发布之前,您需要在每个不包含测试的模块中设置 skip 属性。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-10-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-11-04
      • 2018-02-09
      • 2019-06-16
      相关资源
      最近更新 更多