It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How do I disable Clover during test runs using the Gradle plugin and what is the command line to enable it?

It slows down the test runs quite a bit, so we just want to run it on CI (Jenkins). I can't find any doc about how to set this option.

3 answers

Hello Veronica,

Once the sources are compiled and instrumented there is no option to disable Clover code coverage at runtime. You can control some aspects of coverage recording though.

If possible I would suggest to disable Clover instrumentation/integration in some of your builds if you are not interested in coverage and enable only for specific builds.

Please also read the performance tuning spec: https://confluence.atlassian.com/display/CLOVER/Clover+Performance+Tuning

Cheers,
Jacek

Actually there is an option to disable gathering coverage: -Dclover.enable=false

It should improve the performance but Clover classess and some overhead is still there.

I'm sorry for the confusion.

Cheers,
Jacek

Hi Jacek, thanks for your advice. I'm not sure what you mean here:

"If possible I would suggest to disable Clover instrumentation/integration in some of your builds if you are not interested in coverage and enable only for specific builds."

Could you elaborate?

Hi Veronica,

The point is that if you have an application instrumented by Clover, then for every statement in your code there is one call of the coverage recorder's method. This method call is present in the compiled bytecode.

It means that even if you disable coverage recording using -Dclover.enable=false, then this method is still called - method does nothing in such case, but the call itself still adds some microseconds of overhead.

That's why in order to achieve maximum performance during tests, it's better to recompile the whole appliation without Clover rather than using -Dclover.enable switch.

Cheers
Marek

I need to set it up disabled by default because it slows down some of the builds and not everyone will be interested in the reports.

0 votes

Are you using Clover integration with Gradle as described on the http://gradle.codehaus.org/Cookbook#Cookbook-usingClover page? If yes, then the -PwithClover commandline option enables Clover.

No, we are not using the Cookbook. We are using this plugin:

https://github.com/bmuschko/gradle-clover-plugin

We figured out that in our environment we just have to add our own system property check, e.g.:

clover {
if (System.getProperty('clover.enable') != 'true') {
excludeTasks = ['test']
}
}

Thanks for your help!

-Veronica

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Confluence

What's New in Confluence Cloud – November 2019 Edition

Hey community! This month we’re excited to share brand new features to help you make your mark on Confluence. If you haven’t already, check out our updates from October and September too! Expre...

11,577 views 11 30
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you