EvoSuite / evosuite

EvoSuite - automated generation of JUnit test suites for Java classes
http://www.evosuite.org
GNU Lesser General Public License v3.0
832 stars 341 forks source link

Exception while generating test through MONOTONIC/RANDOM_SEARCH/LIPS using Evosuite-1.1.0 #315

Closed neelofarhassan closed 3 years ago

neelofarhassan commented 3 years ago

Context

  1. When generating test with the version 1.1.0 using default algorithm (do not explicitly set -Dalgorithm), the statistics.csv reports the algorithm as "MONOTONIC_GA", however, test generation logs show that the algorithm is DYNAMOSA.
  2. Furthermore, it throws an exception if I use LIPS, RANDOM_SEARCH or MONOTONIC_GA as a search algorithm.

Steps to Reproduce

Please break down here below all the needed steps to reproduce the issue. [If possible, please upload an example of the project you are generating tests for.]

I am trying to generate tests for the class "net.kencochrane.a4j.DAO.Product" from a4j in SF110 benchmark

EvoSuite Arguments

  1. java -jar /Downloads/evosuite-1.1.0/master/target/evosuite-master-1.1.0.jar -class net.kencochrane.a4j.DAO.Product -projectCP build/classes/:lib -Dshow_progress=false -Djunit_check=false -Dfilter_assertions=false -Dtest_comments=false -Duse_separate_classloader=true -Doutput_variables=TARGET_CLASS,algorithm,criterion,Total_Branches,Covered_Branches,BranchCoverage,Lines,Covered_Lines,LineCoverage,MethodCoverage,Size,Length,MutationScore,Total_Goals,Covered_Goals -Dsearch_budget=120

  2. java -jar /home/unimelb.edu.au/nneelofar/Downloads/evosuite-1.1.0/master/target/evosuite-master-1.1.0.jar -class net.kencochrane.a4j.DAO.Product -projectCP build/classes/:lib -Dshow_progress=false -Djunit_check=false -Dfilter_assertions=false -Dtest_comments=false -Duse_separate_classloader=true -Doutput_variables=TARGET_CLASS,algorithm,criterion,Total_Branches,Covered_Branches,BranchCoverage,Lines,Covered_Lines,LineCoverage,MethodCoverage,Size,Length,MutationScore,Total_Goals,Covered_Goals -Dsearch_budget=120 -Dalgorithm=MONOTONIC_GA

Current Result

Exception for 2:

Thanks

apanichella commented 3 years ago

Hi @neelofarhassan, to use MONOTONIC_GA with Whole-suite generation, you would need to run the command java -jar evosuite.jat -generateSuite -Dalgorithm=MONOTONIC_GA <other args>

neelofarhassan commented 3 years ago

Thanks @apanichella,

What if I want to use MONOTONIC_GA with test cases generation instead of whole-suite? In the previous version, ONOTONIC_GA was the default algorithm and I always assumed that all other algorithms except WSA follow single-test generation strategy, until explicitly specified. Please correct me if I am wrong.

Could you please direct me to any documentation that explains the implementation of all the algorithms in evosuite (especially if it is different from the original implementation )?

apanichella commented 3 years ago

The default configuration (in the previous version of EvoSuite) was MONOTONIC_GA but for the whole-suite approach. A quite complete list of algorithms implemented in EvoSuite is described in the following articles:

A. Panichella, F. M. Kifetew, and P. Tonella. "A large scale empirical comparison of state-of-the-art search-based test case generators." Information and Software Technology 104 (2018): 236-256. J. Campos, Y. Ge, N. Albunian, G. Fraser, M. Eler, A. Arcuri, "An empirical evaluation of evolutionary algorithms for unit test suite generation", Information and Software Technology 104 (2018): 207-235,