<plugin>
<groupId>org.pitest</groupId>
<artifactId>pitest-maven</artifactId>
<version>1.4.0</version>
<configuration>
<mutationThreshold>100</mutationThreshold>
</configuration>
</plugin>
<plugin>
<groupId>org.pitest</groupId>
<artifactId>pitest-maven</artifactId>
<version>1.4.0</version>
<configuration>
<mutationThreshold>100</mutationThreshold>
</configuration>
</plugin>
如果你希望在任何一个变异测试不失败时使PIT失败,那么你只需要将mutationThreshold设置为100,这意味着覆盖所有生成的变异。
最近版本的pitest(我想是1.6.2+)包括测试强度阈值,只考虑覆盖的代码(也就是说,如果应该因未覆盖的行而导致构建失败,您需要添加额外的覆盖限制)。
/**
* Test strength score threshold at which to fail build
*/
@Parameter(defaultValue = "0", property = "testStrengthThreshold")
private int testStrengthThreshold;
相关:
coverageThreshold。 - Darren Forsythe