pitest - PIT需要JUnit 4(但可以运行JUnit 3测试)或TestNG

时间:2017-03-30 11:48:03

标签: maven junit pom.xml junit4 pitest

我正在尝试使用pitest在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>

1 个答案:

答案 0 :(得分:0)

Archiva似乎包含许多不包含任何来源或测试的模块。

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