Install and set-up these programs:
- From the root folder, clone the project:
git clone https://github.com/STAMP-project/dspot.git
- Access to the dspot project directory
cd dspot
- Create DSpot jar (eg
dspot/target/dspot-1.0.0-jar-with-dependencies.jar
)
mvn package -DskipTests
- From the root folder, clone the project
git clone https://github.com/STAMP-project/dhell.git
- Access to the project directory
cd dhell
- Compile application and tests, and run tests:
mvn clean package
- Go to the dhell folder, copy below configuration to the file dspot.properties
#relative path to the target project root from the folder where dspot is executed
project=./
#relative path to the source project from the project properties
src=src/main/java/
#relative path to the test source project from the project properties
testSrc=src/test/java
#java version used
javaVersion=8
# (optional) path to the output folder, default to "output_diversify"
outputDirectory=dspot-out/
# (optional) filter on the package name for mutation analysis ("example" => "example.*")
pitFilterClassesToKeep=eu.stamp.examples.dhell*
- Execute DSpot
java -jar ../dspot/dspot/target/dspot-1.0.5-SNAPSHOT-jar-with-dependencies.jar -p ./dspot.properties -i 1 -t eu.stamp.examples.dhell.HelloAppTest -a MethodAdd
The execution uses these parameters:
- jar: [mandatory] specify the path to the DSpot library
- p: [mandatory] specify the path to the DSpot configuration file.
- i: specify the number of amplification iterations.
- t: fully qualified names of test classes to be amplified.
- a: specify the list of amplifiers to use.
- Check the Output The result of the amplification consists of 15 new tests, as shown in the output below. Those new tests are written to the output folder specified by configuration property outputDirectory (dspot-out/).
======= REPORT =======
PitMutantScoreSelector:
The original test suite kills 104 mutants
The amplification results with 15 new tests
it kills 15 more mutants
2018-01-11 12:50:04,540 INFO fr.inria.diversify.dspot.DSpot - Print AmplHelloAppTest with 15 amplified test cases in dspot-out/
81162 ms
DSpot produces 3 outputs in the (default: outputDirectory) specified in the properties file.
- a textual report of the result of the amplification also printed on the standard output (see dspot/dspot-out/*.HelloAppTest_mutants_report.txt)
- a json file summarizing the amplification (see dspot/dspot-out/*.HelloAppTest_mutants_killed.json)
- the amplified tests augmented with comments (see dspot/dspot-out/*/AmplHelloAppTest.java)
- From the root folder, clone the project
git clone https://github.com/STAMP-project/dheg.git
- Access to the project directory
cd dheg
- Init Gradle
gradle init
- Configure Gradle. Open build.gradle file and uncomment row 9 and 31
/*
* This build file was generated by the Gradle 'init' task.
*
* This generated file contains a commented-out sample Java project to get you started.
* For more details take a look at the Java Quickstart chapter in the Gradle
* user guide available at https://docs.gradle.org/4.1/userguide/tutorial_java_projects.html
*/
// Apply the java plugin to add support for Java
apply plugin: 'java'
// In this section you declare where to find the dependencies of your project
repositories {
// Use 'jcenter' for resolving your dependencies.
// You can declare any Maven/Ivy/file repository here.
jcenter()
}
// In this section you declare the dependencies for your production and test code
dependencies {
// The production code uses the SLF4J logging API at compile time
compile 'org.slf4j:slf4j-api:1.7.25'
// Declare the dependency for your favourite test framework you want to use in your tests.
// TestNG is also supported by the Gradle Test task. Just change the
// testCompile dependency to testCompile 'org.testng:testng:6.8.1' and add
// 'test.useTestNG()' to your build script.
testCompile 'junit:junit:4.12'
}
- Build the project
gradle build
- From the root folder copy the configuration to the file dheg/dspot.properties
#relative path to the project root from dspot project
project=../dheg
#relative path to the source project from the project properties
src=src/main/java/
#relative path to the test source project from the project properties
testSrc=src/test/java
#java version used
javaVersion=8
# (optional) path to the output folder, default to "output_diversify"
outputDirectory=dspot-out/
# (optional) filter on the package name for mutation analysis ("example" => "example.*")
pitFilterClassesToKeep=eu.stamp.examples.dhell*
- Execute DSpot
cd dspot
java -jar target/dspot-1.0.0-jar-with-dependencies.jar -p ../dheg/dspot.properties -i 1 -t eu.stamp.examples.dhell.HelloAppTest -b GradleBuilder -a MethodAdd
The execution uses these parameters:
- p: [mandatory] specify the path to the configuration file.
- i: specify the number of amplification iteration.
- t: fully qualified names of test classes to be amplified.
- b: specify the automatic builder to build the project.
- a: specify the list of amplifiers to use.
- The result of the amplification consists of 15 new tests, as shown in the output below. Those new tests are written to the output folder specified by configuration property outputDirectory (dspot-out/).
======= REPORT =======
PitMutantScoreSelector:
The original test suite kill 103 mutants
The amplification results with 15 new tests
it kill 13 more mutants
01:25 INFO: Print AmplHelloAppTest with 15 amplified test cases in dspot-out/
46032 ms
DSpot produces 3 outputs in the (default: outputDirectory) specified in the properties file.
- a textual report of the result of the amplification also printed on the standard output (see dspot/dspot-out/*.HelloAppTest_mutants_report.txt)
- a json file summarizing the amplification (see dspot/dspot-out/*.HelloAppTest_mutants_killed.json)
- the amplified tests augmented with comments (see dspot/dspot-out/*/AmplHelloAppTest.java)
We hope this quick overview has increased your interest in DSpot usage. Note that this is a very truncated quick-start guide. Now you are ready for more comprehensive details concerning the actions you have just performed. Check out the DSpot Readme Guide.