rjust / defects4j

A Database of Real Faults and an Experimental Infrastructure to Enable Controlled Experiments in Software Engineering Research
MIT License
741 stars 303 forks source link

JacksonXml failure to generate test cases using EvoSuite #441

Closed islamelgendy closed 1 month ago

islamelgendy commented 3 years ago

Hi there,

I tried to generate some test suite for the JacksonXml project using the EvoSuite generator. However, it is failing to do so using any version of the fixed versions (from 1 to 6). The command that I used: gen_tests.pl -g evosuite -p JacksonXml -v 1f -n 50 -o [output dir] -b 30

This gives the following output:

ERROR EvoSuite - Fatal crash on main EvoSuite process. Class  using seed 50006. Configuration id : null
java.lang.IllegalArgumentException: Classpath element does not exist on disk at: /home/islam/MyWork/Code/defects4j/framework/projects/JacksonXml/lib/javax/xml/stream/stax-api/1.0-2/stax-api-1.0-2.jar
    at org.evosuite.classpath.ClassPathHandler.checkIfValidClasspathEntry(ClassPathHandler.java:211) ~[evosuite-1.0.6.jar:1.0.6]
    at org.evosuite.classpath.ClassPathHandler.getClassPath(ClassPathHandler.java:118) ~[evosuite-1.0.6.jar:1.0.6]
    at org.evosuite.classpath.ClassPathHandler.changeTargetClassPath(ClassPathHandler.java:105) ~[evosuite-1.0.6.jar:1.0.6]
    at org.evosuite.CommandLineParameters.handleClassPath(CommandLineParameters.java:226) ~[evosuite-1.0.6.jar:1.0.6]
    at org.evosuite.EvoSuite.parseCommandLine(EvoSuite.java:184) ~[evosuite-1.0.6.jar:1.0.6]
    at org.evosuite.EvoSuite.main(EvoSuite.java:302) ~[evosuite-1.0.6.jar:1.0.6]
FAIL
Executed command: /home/islam/MyWork/Code/defects4j/framework/lib/test_generation/bin/evosuite.sh

Executing command:
java -cp /home/islam/MyWork/Code/defects4j/framework/lib/test_generation/generation/evosuite-current.jar org.evosuite.EvoSuite     -class com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator     -projectCP /tmp/gen_tests.pl_3255527_1629297742/target/classes:/home/islam/MyWork/Code/defects4j/framework/projects/JacksonXml/lib/com/fasterxml/jackson/core/jackson-core/2.9.8/jackson-core-2.9.8.jar:/home/islam/MyWork/Code/defects4j/framework/projects/JacksonXml/lib/com/fasterxml/jackson/core/jackson-annotations/2.9.0/jackson-annotations-2.9.0.jar:/home/islam/MyWork/Code/defects4j/framework/projects/JacksonXml/lib/com/fasterxml/jackson/core/jackson-databind/2.9.8/jackson-databind-2.9.8.jar:/home/islam/MyWork/Code/defects4j/framework/projects/JacksonXml/lib/com/fasterxml/jackson/module/jackson-module-jaxb-annotations/2.9.8/jackson-module-jaxb-annotations-2.9.8.jar:/home/islam/MyWork/Code/defects4j/framework/projects/JacksonXml/lib/javax/xml/stream/stax-api/1.0-2/stax-api-1.0-2.jar:/home/islam/MyWork/Code/defects4j/framework/projects/JacksonXml/lib/org/codehaus/woodstox/stax2-api/3.1.4/stax2-api-3.1.4.jar:/home/islam/MyWork/Code/defects4j/framework/projects/JacksonXml/lib/com/fasterxml/woodstox/woodstox-core/5.0.3/woodstox-core-5.0.3.jar     -seed 50006     -Dsearch_budget=15     -Dassertion_timeout=15     -Dtest_dir=/tmp/gen_tests.pl_3255527_1629297742/evosuite     -criterion branch -Dstopping_condition=MaxTime -Dshow_progress=false -Djunit_check=false -Dfilter_assertions=false -Dtest_comments=false -mem 1500 
FAILED
Failed to generate tests! at /home/islam/MyWork/Code/defects4j/framework/bin/gen_tests.pl line 264.

It is worth noting that I was able to generate test suites using randoop.

Thanks and best, Islam

rjust commented 3 years ago

Thanks for reporting this. It looks like the exported classpath includes invalid entries. The next major release will fix this (for this and other projects).

As a workaround, you can run export -p cp.compile in the working directory of a checked-out project version (e.g., JacksonXml-1f), see what's missing, and add it to the referenced lib folder (or link to an existing library from that lib folder).

A pull request with your fixes would be appreciated.

Let me know if you have further questions.

rjust commented 1 month ago

Running gen_tests.pl -g evosuite -p JacksonXml -v 1f -n 50 -o [output dir] -b 30 successfully generates a test suite in Version 3.