Open Tracy-X opened 7 years ago
EvoSuite uses only JVM bytecode, so in theory it may work, even though it will only produce regular Java output. In practice, there will likely be some issues with dependencies and some other groovy specifics. Why don't you simply try setting the classpath up appropriately and running EvoSuite as usual (with target class and classpath set)?
hi gofraser i try to use command line as below:
java -cp D:\Tools\groovy-2.4.7 -jar evosuite-1.0.3.jar -generateTests -target .\bin\ but it will throw the error , could u help to advise? it is my command wrong? / [MASTER] 15:39:28.099 [logback-2] ERROR TestClusterGenerator - Problem for test. Helloword. Class not found java.lang.ClassNotFoundException: groovy/lang/GroovyObject at org.evosuite.instrumentation.InstrumentingClassLoader.instrumentClass (InstrumentingClassLoader.java:199) ~[evosuite-1.0.3.jar:1.0.3] at org.evosuite.instrumentation.InstrumentingClassLoader.loadClass(Instr umentingClassLoader.java:166) ~[evosuite-1.0.3.jar:1.0.3] at org.evosuite.setup.TestClusterGenerator.addCastClassDependencyIfAcces sible(TestClusterGenerator.java:277) [evosuite-1.0.3.jar:1.0.3] at org.evosuite.setup.TestClusterGenerator.handleCastClasses(TestCluster Generator.java:216) [evosuite-1.0.3.jar:1.0.3] at org.evosuite.setup.TestClusterGenerator.generateCluster(TestClusterGe nerator.java:132) [evosuite-1.0.3.jar:1.0.3] /
Evosuite uses the ASM library for interacting with bytecode, which may not support other JVM languages (at least to the best of our knowledge, the library is not compatible with Scala).
Although the same problem may apply to Groovy, can you confirm whether the groovy jar (e.g., http://central.maven.org/maven2/org/codehaus/groovy/groovy-all/2.4.8/groovy-all-2.4.8.jar ) is on the classpath?
To add to my previous comment, it seems that I am getting the same error on a test groovy package.
So, the answer is that Evosuite does not support Groovy, at least for now.
While it is indeed likely that it doesn't work, doesn't that error message simply say that the Groovy library is not on the classpath? So what exactly is the problem? Is there some example compiled Groovy code to test this with?
java -jar evosuite-1.0.3.jar -base_dir D:\Tools\eclipse-mars-groovy\workspace\Tracy-Groovy\UnitTest\ -target D:\Tools\groovy-2.4.7\embeddable\groovy-all-2.4.7.jar -projectCP D:\Tools\eclipse-mars-groovy\workspace\Tracy-Groovy\bin\ -generateMOSuite -class test.Helloword
add a -target to config the jar for groovy, seems it can generate the testcase, but it will throw error after testcase done. /*
If you use -target groovy-all.jar then you're generating tests for Groovy itself (which I assume is not written in Groovy, is it?) rather than the classes you're interested in. Use your own project as target.
Use the following (assuming that a semicolon is the path separator on windows): -projectCP D:\Tools\eclipse-mars-groovy\workspace\Tracy-Groovy\bin;D:\Tools\groovy-2.4.7\embeddable\groovy-all-2.4.7.jar ...and then set -target or -class to something of your own project.
On a simple Groovy example this worked fine for me and I got some tests.
The errors you're getting from ClassStateSupport in your last comment shouldn't stop EvoSuite from writing tests, it just means that something went wrong when EvoSuite was trying to reset the classes (this is what it does to avoid flaky tests). Maybe this should be labelled warning, rather than error, since the worst that will happen will be flaky tests if the code is non-deterministic.
thanks for your help, i try a simple case, can work, but seems the coverage is reduced. and there is another problem which is it failed to find the class (shows Empty className), event i double check the class exists (used the command -listClasses to check it) /*
can it support closure? (closure in groovy...)
Dear all,
may i know is it possible to use EvoSuite to test groovy code?if yes, what should i do?