Groovy per-test instrumentation

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 vote

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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published May 30, 2018 in Marketplace Apps

Three tips for boosting your board's efficiency with Story Maps

Trello is one of the most effective tools for driving your sprints. It's customizable for every Agile team and product owners and Scrum masters (SM) love it. However, Agile teams often struggle with:...

818 views 2 9
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