Groovy per-test instrumentation


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 **/* 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.



1 answer

This widget could not be displayed.

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"/>

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.


Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Published Jul 25, 2018 in Marketplace Apps

Jira Cloud and Bitbucket Cloud Integration with Microsoft Teams

One of the newest products in the Microsoft family - Microsoft Teams,  is a chat-based hub for teamwork that integrates all the people, content, and tools your team needs to be more engaged and ...

718 views 0 3
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you