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

Unable to create test classes using evosuite #364

Closed RSoodAMAT closed 3 years ago

RSoodAMAT commented 3 years ago

Context

I have a gradle project . I build the project and my classes got generated under build/classes/java/main/com/poc/utility/MathsUtil.class

I tried running the command line command to generate test case : $EVOSUITE -class com.poc.utility.MathsUtil -projectCP build/classes

I am using evosuite-1.1.0.jar for EVOSUITE Java Version 14 Spring Boot version : 2.5.1

Getting below exception :

EvoSuite 1.1.0

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.]

  1. Create a gradle spring boot java project using jdk 8 and above
  2. Try to create test cases for any one of the class in the package using the EVOSuite command

EvoSuite Arguments

$EVOSUITE -class com.poc.utility.MathsUtil -projectCP build/classes

Current Result

Getting below exception :

EvoSuite 1.1.0

Expected result

Test case should be generated successfully .

Additional info

Please add any information of interest here below

rkraneis commented 3 years ago

Did you already try $EVOSUITE -class com.poc.utility.MathsUtil -projectCP build/classes/java/main? Gradle seems to put the compiled classes into different places than Maven.

gofraser commented 3 years ago

Thanks @rkraneis -- indeed the correct classpath must be build/classes/java/main according to the first statement in the bug report, not build/classes, so the correct usage would be $EVOSUITE -class com.poc.utility.MathsUtil -projectCP build/classes/java/main

Barry1915 commented 2 years ago

image