Hi,
I am using the Ant tasks to create code coverage for Groovy and Java files. For Groovy files I do not see any per-test coverage in my HTML report. For Java classes this works fine. In my Ant clover-setup task I define the patterns **/*Test.java as well as **/*Test.groovy as filesets for testsources. I do the same when using the task clover-report. The manual states that you need to use fully qualified class names in your test sources for annotations and classes. I tried that but it still doesn't do it (also I think that this is not usable). Is this still true with Clover 3.1? How does the Grails plugin do the trick. It looks like I am missing something. Any help would be highly appreciated.
Thanks,
Ben
Hi Benjamin,
Please have a look at the Test+Optimization+Quick+Start+Guide+for+Ant chapter "Running Java and Groovy test cases".
According to Ant documentation, the <junit>/<batchtest> collects the included resources from any number of nested resource collections and then generates a test class name for each resource that ends in .java or .class. It means that if you put *.groovy extension, such files will be ignored.
However, you can pass compiled classes to junit Ant task, for instance:
<fileset dir="${build.dir}"> <include name="**/*Test.class"/> </fileset>
Then Ant will find both Java and Groovy tests.
Please bear in mind that currently Clover cannot optimize Groovy test cases. An improvement CLOV-1152 will solve this problem.
References:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.