我正在尝试运行由 evosuite 生成的单元测试,但是 maven-surefire-plugin 抛出了一个 classnotfound 错误,而“缺失”类似乎在类路径中。
当我尝试运行测试时,调试日志显示在surefire 尝试运行测试时evosuite 位于类路径上;
[DEBUG] test(compact) classpath: test-classes classes junit-4.12.jar hamcrest-core-1.3.jar evosuite-standalone-runtime-1.0.6.jar
[DEBUG] provider(compact) classpath: surefire-junit4-2.17.jar surefire-api-2.17.jar
但它失败了;
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.17:test (default-test) on project Tutorial_Maven: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.17:test failed: There was an error in the forked process
[ERROR] java.lang.NoClassDefFoundError: org.evosuite.runtime.thread.KillSwitch
我仔细检查了 Killswitch 类是否在 evosuite jar 文件中,并且看起来确实如此。
为了完整起见,这里是mvn -version
;
Apache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297; 2018-02-24T20:49:05+01:00)
Maven home: /home/marijn/git/Tutorial_Maven/EMBEDDED
Java version: 1.8.0_252, vendor: Eclipse OpenJ9
Java home: /home/marijn/.sdkman/candidates/java/8.0.252.j9-adpt/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.6.11-100.fc30.x86_64", arch: "amd64", family: "unix"
我正在运行的完整命令(在遵循指南@ https://www.evosuite.org/documentation/tutorial-part-2/之后)是mvn clean compile test-compile evosuite:generate evosuite:export evosuite:prepare test
使用 evosuite 参数 memoryInMB = 4000 和 cores = 4。