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

This widget could not be displayed.

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

This widget could not be displayed.

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.

This widget could not be displayed.

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
Atlassian Summit 2018

Meet the community IRL

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

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

121 views 2 0
Join discussion

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