Groovy per-test instrumentation

Benjamin Muschko September 29, 2011

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

1 answer

0 votes
Marek Parfianowicz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 11, 2012

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:

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events