java - 如何集成EvoSuite测试用例生成工具

标签 java testing evosuite

我已阅读以下链接中的文档

Documentation | EvoSuite

但是,我仍然不清楚如何使用EvoSuite

当我编写 java -jar evosuite.jar -help 命令时,出现以下错误

Could not find the main class: org.evosuite.Evosuite. Program will exit.

感谢任何帮助。

最佳答案

我已经使用 Evosuite 一年多了,它对我来说效果很好。尝试再次下载。下面是一个小示例,说明它如何在名为 Plant 的类上工作。位于包 PlantTest 中并使用 -projectCP 将依赖项放入类路径中选项。

java -jar evosuite.jar -class PlantTest.Plant -projectCP ./PlantMutant.jar
* EvoSuite 
* Going to generate test cases for class: PlantTest.Plant
* Starting client
* Connecting to master process on port 12405
* Analyzing classpath: 
  - ./PlantMutant.jar
* Finished analyzing classpath
* Generating tests for class PlantTest.Plant
* Test criterion:
  - Branch coverage
* Setting up search algorithm for whole suite generation
[Progress:>                             0%] [Cov:>                                  0%]* Total number of test goals: 29
* Using seed 1430263541223
* Starting evolution
[Progress:>                             3%] [Cov:===================================100%]
* Search finished after 2s and 2 generations, 5815 statements, best individual has fitness: 
  - Branch 0.0
* Minimizing test suite
* Coverage of criterion BRANCH: 100%
* Generated 11 tests with total length 24
* Resulting test suite's coverage: 100%
* GA-Budget:
    - RMIStoppingCondition
    - ShutdownTestWriter :               0 / 0           
    - ZeroFitness :                      0 / 0            Finished!
    - MaxTime :                          3 / 60          
* Time spent executing tests: 2256ms
* Generating assertions
* Resulting test suite's mutation score: 72%
* Compiling and checking tests
* Writing JUnit test case 'PlantEvoSuiteTest' to evosuite-tests
* Done!

* Computation finished

希望有帮助。

关于java - 如何集成EvoSuite测试用例生成工具,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27217676/

相关文章:

java - 如何只构建evosuite的客户端模块

testing - EvoSuite - 获得最多代码覆盖率的参数

java - Spring Boot @ConfigurationProperties 从 yaml 加载列表不起作用

ruby-on-rails - 在 Ruby on Rails 中运行每个测试需要多长时间?

java - 单元测试方法在运行测试时不使用模拟对象。而是调用实际的类和方法

testing - Selenium 2.0/网络驱动程序

java - 在 Android 上更新弹出窗口上的 textview 时出错

java - 如何在javaFx中绘制具有多个点的线?

java - 需要构造函数参数的 ReSTLet 服务器资源