0

I'm trying to generate Java unit test cases using Randoop. Suppose I've a class named ABC. Inside class ABC, I've instantiated the Logger class of log4j as a field and this field is being accessed by a method. I've listed class ABC in myClasses.txt. Now while running the gentests command, I'm getting noClassDefFound error for the Logger instance. Please help if we're missing on something?

Gopi
  • 620
  • 8
  • 16

2 Answers2

0

You have to put Logger class also in myClasses.txt. Also provide log4j properties file in java -Dlog4j.configuration=file:...

0

The command line for running Randoop includes a classpath argument. Is the log4j jar file included in the classpath provided to Randoop? Your command line should look something like:

java -classpath %RANDOOP_JAR%;%ABC_HOME%;%LOG4J_JAR% randoop.main.Main gentests --testclass=ABC

where %ABC_HOME% is an environment variable indicating where your ABC class resides, and %LOG4J_JAR% refers to the location of your log4j jar file. (This is in Windows notation. Linux paths use ":" separators rather than ";" separators.) And of course you don't need to use environment variables. You can just plug in the appropriate paths.

kc2001
  • 5,008
  • 4
  • 51
  • 92