Skip to content

Evosuite++: an enhancement for Evosuite framework supporting new features like optimal object construction and gradient recovering

Notifications You must be signed in to change notification settings

FudanSELab/evosuite-plus-plus-hacked

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status CircleCI

Evosuite++

This project is a forked version of Evosuite. The original address of evosuite is here: https://github.com/EvoSuite/evosuite. The goal of this project aims to improve Evosuite from the perspective of gradient recovering, a paramount assumption of the effectiveness of SBST (Search-based Software Testing). The traditional SBST approaches defines the measurement (e.g., branch distance) for evaluating how far a generated test is away from covering a branch. Such a measurement is considered as a loss function (or fitness function) to guide test generation to cover specific branches with various search algorithm e.g., GA (Genetic Algorithm), Hill Climbing, etc. However, more often than not, the landscape of the search space is not continuous, which makes SBST approaches degrade to random testing.

The project (Evosuite++) aims to pinpoint when the landscape is not conitinuous and propose various approaches to restore the effectiveness of SBST, e.g., recovering gradients for inteprocedural flag problem and constructing shortcut seeds to facilitate test generation.

In this project, we enhance Evosuite in terms of branch distance gradient recovering, object construction, smarter mutation, etc. Here is the relevant publication:

  • Yun Lin, Jun Sun, Gordon Fraser, Ziheng Xiu, Ting Liu, and Jin Song Dong. Recovering Fitness Gradients for Interprocedural Boolean Flags in Search-Based Testing (ISSTA 2020), 440--451. (Acknowledge*: Thanks Lyly Tran's contribution to set up our experiment despite her name is not list on the paper.)
  • Yun Lin, You Sheng Ang, Jun Sun, Gordon Fraser, and Jin Song Dong. Graph-based Seed Object Synthesis for Search-Based Unit Testing (ESEC/FSE 2021).

You may refer to our website for more information on this project and how to run the experiment demonstrated in our paper: https://sites.google.com/view/evoipf/home and https://sites.google.com/view/evoobj/home

Building EvoSuite

EvoSuite uses Maven.

First, ensure you have maven installed, to check, run

mvn -v

To build EvoSuite in Eclipse, make sure you have the M2Eclipse plugin installed, and import EvoSuite as Maven project. This will ensure that Eclipse correctly configure the Maven project.

Building EvoSuite in Eclipse

In eclipse, we need to import Evosuite projects by Import>>Maven>>Existing Maven Projects. In general, we may import the following projects for compiling Evosuite:

  • evosuite
  • evosuite-client
  • evosuite-master
  • evosuite-runtime
  • evosuite-shell

JDK version

EvoSuite++ supports JDK1.8. We are working on the project to support the above version.

The path of tools.jar

After importing all the above projects, we need to modify pom.xml in evosuite project as follows (here is an Eclipse bug, which makes the IDE fail to recognize correct Java home path even if we set the correct JDK path in Eclipse, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=432992): We find <tools-default> and replace its <exists> and <toolsjar> element with the file location inside project. For example:

<id>tools-default</id>
  <activation>
    <activeByDefault>true</activeByDefault>
    <file>
      <exists>C:\Program Files\Java\jdk1.8.0_261\libs\tools.jar</exists>
    </file>
    </activation>
    </properties>
       <toolsjar>C:\Program Files\Java\jdk1.8.0_261\libs\tools.jar</toolsjar>
    </properties>

A more systematic way to resolve the problem is to use customized maven settings where the java.home environment is manually defined. Technically, you should customize your IDE (e.g., eclipse) to use the downloaded maven, where the conf\settings.xml be set as

<profiles>
	<profile>
      <id>compiler</id>
        <properties>
          <java.home>C:\Program Files\Java\jdk1.8.0_202\bin</java.home>
        </properties>
 </profile>
<profiles>
<activeProfiles>
  <activeProfile>compiler</activeProfile>
</activeProfiles>

Then, right click the project >> Maven >> Ipdate Project ... By this means, the problem can be fixed.

Compilation

To work on EvoSuite++ source code (forked from EvoSuite project by Prof. Gordon Fraser), we need to compile Evosuite to generate some source code. We suggest to remove the dependency of evosuite-master component on evosuite-client-test (i.e., the evosuite-client test-jar file) to compile the source code first. The maven command to compile EvoSuite++ is: mvn clean source:jar install -Ppackage-jars -T 4

After compilation, the "evosuite-master" project may have some compilation errors. In this case, we may include the target/generated-sources/jaxb folder as build path.

FAQ

  1. If you encounter com.sun dependency issue:

    Please replace the corresponding tools.jar with the absolute path of the jdk tools.jar and the error will go away.

  2. If you encounter CUTxxx class not found issue:

This issue occurred because some code on which evosuite master depends is not correctly generated as expected. To remedy this in Eclipse IDE, we need to manually generate the code. This can be done via Run Configurations under options of the Run button. Right click the Maven Build tab and click New Configuration.

Enter ${workspace_loc:/evosuite-master} for Base Directory and jaxb2:xjc for Goals. Give any arbitrary name and hit Run.

The above Maven job will generate required classes.

Furthermore, in order to run unit test cases in GenerationTest class, navigate to shell module, mark src/test/java and src/test/resources folders as src. Now, you are all set, run unit tests one by one and see the graph generation process for yourself :).

About

Evosuite++: an enhancement for Evosuite framework supporting new features like optimal object construction and gradient recovering

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 98.4%
  • Shell 0.7%
  • JavaScript 0.4%
  • Python 0.2%
  • Batchfile 0.1%
  • CSS 0.1%
  • Other 0.1%