STAMP-project / evosuite-ramp-tutorial

This repository contains the tutorial material to run EvoSuite using behavioural models seeding.
0 stars 1 forks source link

java.lang.RuntimeException: not supported: class org.evosuite.utils.generic.WildcardTypeImpl #5

Open MaelAudren opened 5 years ago

MaelAudren commented 5 years ago

Characteristics

Description

The exception java.lang.RuntimeException: not supported: class org.evosuite.utils.generic.WildcardTypeImpl appears in the log after sucessfully running evosuite-model-seeding against the catalog

Steps to reproduce

Run the following commands: git clone https://github.com/ow2-proactive/catalog cd catalog

Add the following lines to the build.gradle with your favorite editor

task testJar(type: Jar) {
    classifier = 'tests'
    from sourceSets.main.output+sourceSets.test.output
}

task('getClasspath') << {

    File classpathFile = new File("catalogClasspath.txt")
    String content = "";
    configurations.testCompile.each {
        content+=it
    content+=":"
    }
    content+="/media/mael/stamp/wp3/projects/catalog/build/libs/catalog-10.1.0-SNAPSHOT-tests.jar"
    classpathFile.write(content);
}

Run the following commands ./gradlew testJar ./gradlew getClasspath java -d64 -Xmx10000m -jar bin/botsing-model-generation-1.0.4-SNAPSHOT-jar-with-dependencies.jar -project_cp $CLASSPATH -project_prefix org.ow2.proactive.catalog.rest.controller -out_dir OUTDIR where CLASSPATH is the path to CATALOG_DIR/catalogClasspath.txt and OUTDIR is the result output directory.

Exception:

catalogTestOutput.txt

xdevroey commented 5 years ago

Hi @MaelAudren,

I have tried to generate test cases on my machine and it seems to work. Here is the step-by-step:

  1. Checkout the project and the tutorial to get the binaries:

    git clone https://github.com/ow2-proactive/catalog
    git clone https://github.com/STAMP-project/evosuite-model-seeding-tutorial.git
    cd catalog
  2. Build and test

    ./gradlew test 
  3. Modify the build file and add your code (minus the hack for the jar file) to get the classpath (not sure that the other part is needed):

    task('getClasspath') << {
    
    File classpathFile = new File("catalogClasspath.txt")
    String content = "";
    configurations.testCompile.each {
        content+=it
    content+=":"
    }
    classpathFile.write(content);
    }
  4. Export the classpath:

    ./gradlew getClasspath
    export catalog_classpath="build/classes/main/:build/classes/test/:"$(cat catalogClasspath.txt)
  5. Build the models:

    java -d64 -Xmx10000m -jar ../evosuite-model-seeding-tutorial/bin/botsing-model-generation-1.0.4-SNAPSHOT-jar-with-dependencies.jar \
    -project_cp "$catalog_classpath" \
    -project_prefix "org.ow2.proactive.catalog" \
    -out_dir "results"
  6. Remove test classes from the classpath (or use a different variable):

    export catalog_classpath="build/classes/main/:"$(cat catalogClasspath.txt)
  7. Optionally, you can list the testable classes:

    java -d64 -Xmx4000m -jar ../evosuite-model-seeding-tutorial/bin/evosuite-master-1.0.7-SNAPSHOT.jar -listClasses -projectCP "$catalog_classpath" -prefix "org.ow2.proactive.catalog"
  8. And run EvoSuite + model seeding on one of them (or a subpackage, see EvoSuite documentation for the exact parameters to use for that):

    java -d64 -Xmx4000m -jar ../evosuite-model-seeding-tutorial/bin/evosuite-master-1.0.7-SNAPSHOT.jar \
    -class "org.ow2.proactive.catalog.util.LinkUtil" \
    -projectCP "$catalog_classpath" \
    -generateMOSuite \
    -Dalgorithm=DynaMOSA \
    -Dsearch_budget=60 \
    -Dseed_clone="0.5" \
    -Donline_model_seeding=TRUE \
    -Dmodel_path="results/models" \
    -Dtest_dir="results/evosuite-tests" \
    -Dreport_dir="results/evosuite-report" \
    -Dno_runtime_dependency=true
  9. Tests are generated in results/evosuite-tests.