RMDev
RMDev

Reputation: 163

How to integrate EvoSuite test case generation tool

I have read the documentation in the following link

Documentation | EvoSuite.

But, it's still not clear for me how to use EvoSuite.

And when I write the java -jar evosuite.jar -help command, I get the following error

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

I appreciate any help.

Upvotes: 2

Views: 1540

Answers (1)

Charan Raj
Charan Raj

Reputation: 481

I have been using Evosuite for over a year and it works fine for me. Try downloading it again. Here is a small example of how it works on a class named Plant which is in the package PlantTest and put your dependencies in the class path using -projectCP option.

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

Hope it helps.

Upvotes: 2

Related Questions