Explanations to run Botsing/Evosuite on XWiki modules
First time and until new versions of Botsing/Evosuite are released
git clone https://github.com/STAMP-project/evosuite.git
mvn clean install -DskipTests
git clone https://github.com/STAMP-project/botsing.git
- Modify
pom.xml
diff --git a/pom.xml b/pom.xml
index a693ebf..06ede8d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -72,7 +72,7 @@
<commons-cli.version>1.4</commons-cli.version>
<!-- <coveralls-maven-plugin.version>4.3.0</coveralls-maven-plugin.version> -->
<evosuite.version>1.0.6</evosuite.version>
- <evosuite-client.version>1.0.7</evosuite-client.version>
+ <evosuite-client.version>1.0.7-SNAPSHOT</evosuite-client.version>
<guava.version>27.0.1-jre</guava.version>
<hamcrest.version>2.0.0.0</hamcrest.version>
@@ -421,4 +421,4 @@
<module>botsing-parsers</module>
</modules>
-</project>
\ No newline at end of file
+</project>
- Install jar in local maven repo:
cd botsing-reproduction/
andmvn install:install-file -Dfile=evosuite-client-botsing-1.0.7.jar -DgroupId=org.evosuite -DartifactId=evosuite-client-botsing -Dversion=1.0.7-SNAPSHOT -Dpackaging=jar
- Build botsing:
mvn clean install -DskipTests
To execute on a xwiki module
- Cd to the module director, for example for Commons XML:
cd xwiki-commons-xml
. - Set CP variable. Run
mvn dependency:build-classpath
and copy results in$xwikic
p shell variable and addtarget/classes
andtarget/test-classes
too:
export xwikicp="target/classes:target/test-classes:<copied path>"
- Execute botsing seeding to generate a model of the code:
java -d64 -Xmx10000m -jar ~/.m2/repository/eu/stamp-project/botsing-model-generation/1.0.8-SNAPSHOT/botsing-model-generation-1.0.8-SNAPSHOT-jar-with-dependencies.jar -project_cp "$xwikicp" -project_prefix "org.xwiki.xml" -out_dir target/botsing
- Note that Botsing Seeding has 2 phases to generate the model: a static analysis phase and a dynamic analysis one (by executing the tests). However, currently Botsing/Evosuite don’t support JUnit5 tests so the dynamic phase won’t execute the JUnit5 tests. The model is still generated but is a bit less good that what it could be.
- Execute Evosuite to generate the tests (notice the
-class
parameter to specify for which class to generate tests for):
java -d64 -Xmx4000m -jar ~/.m2/repository/org/evosuite/evosuite-master/1.0.7-SNAPSHOT/evosuite-master-1.0.7-SNAPSHOT.jar \
-target "target/classes" \
-projectCP "$xwikicp" \
-generateMOSuite \
-Dalgorithm=DynaMOSA \
-Dsearch_budget=60 \
-Dseed_clone="0.5" \
-Donline_model_seeding=TRUE \
-Dmodel_path="target/botsing/models" \
-Dtest_dir="target/botsing/evosuite-tests" \
-Dreport_dir="target/botsing/evosuite-report" \
-Dno_runtime_dependency=true
- Note that you can pass
-prefix "org.xwiki.xml"
to generate tests for all classes in the passed package. - Generated tests can be found in
target/botsing/evosuite-tests
.
For history, see No test suite found with botsing commons behavior seeding · Issue #3 · STAMP-project/evosuite-ramp · GitHub