EvoSuite-Jacoco-IDEA
To set up test environment
- Create a new Maven project
- Create a peice of java code under
src/main/java
, e.g,codeToTest.java
- Create a junit script under
src/test/java
, e.g,codeToTestTest.java
- Modify your
pom.xml
like pom.xml. - Dowload all dependencies
Jacoco
in IDEA
To use - Click
Run
then clickEdit Configuration
- Find
Code Coverage
- Select
Jacoco
EvoSuite
in Terminal
To run - First get in the directory of your maven project
- Run
mvn evosuite:generate
, you will find the generated tests under.evosuite
- By running
mvn evosuite:generate evosuite:export
, the tests will be generated automatically undersrc/test/java
EvoSuite
in IDEA GUI
To run - Go to Plugin Market and search EvoSuite
- Install
EvoSuite Plugin
and restart IDEA IDE - Right click the junit script and select
Run EvoSuite
- Customize your configuration
- Maven location: for ubuntu:
/usr/share/maven/bin/mvn
(apt install maven) - JAVA_HOME
After all these steps, you will get two java files
*_ESTest
*_ESTest_scaffolding
Just discard*_ESTest_scaffolding
, it is useless. And comment@RunWith*
andextends *_ESTest_scaffolding
. Or copy the generated test scripts to your own file.
Environment requirement: Java 8