我有一个文件夹“mutant”,其中包含一个文本文件,其中只有一行名为java.utils.Collection
。我已经使用 Randoop 生成了测试用例并将它们保存在同一文件夹中。测试用例的名称为 RegressionTest*.java
我现在正在尝试运行 PIT 来生成突变体。我按照 http://pitest.org/quickstart/commandline/ 输入的命令如下——
java -cp C:\Users\happy\OneDrive\Desktop\pitest-1.4.3.jar;C:\Users\happy\OneDrive\Desktop\pitest-command-line-1.4.3.jar;C:\Users\happy\OneDrive\Desktop\pitest-entry-1.4.3.jar;C:\Users\happy\OneDrive\Desktop\junit-4.10.jar;C:\Users\happy\OneDrive\Desktop\testng-6.8.5.jar
org.pitest.mutationtest.commandline.MutationCoverageReport
--reportDir C:\Users\happy\OneDrive\Desktop\report
--targetClasses myclasses.*
--targetTests mutant.Regression*
--sourceDirs C:\Users\happy\OneDrive\Desktop\mutant
我收到的错误是 Exception in thread "main". org.Pitest.help.PitHelpError: No mutations found. This probably means there is an issue with either the supplied classpath or filters
我认为该问题与 targetClasses 有关。有人有什么想法吗?
最佳答案
Collection
位于 java.util
中,而不是 java.utils 中。
您可以检查是否确实生成了测试。
此外,我认为您希望 Pitest 改变的测试代码应该具有由 --sourceDirs 指示的源代码。
关于Java PIT 类路径问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52910313/