Excluding classes/packages from clover coverage report

Hi all,

we use clover for generating test coverage reports for our graph library.

<address> http://userpages.uni-koblenz.de/~ist/jgralab/coverage/report/</address><address> </address><address>We use Clover for Ant, thus our build.xml contains:</address>

<property name="clover.jar" value="${lib.dir}/clover/clover-3.1.0.jar" />

<taskdef resource="cloverlib.xml" classpath="${clover.jar}" />

<target name="with.clover">

<clover-setup />

</target>

<target name="clover.html">

<clover-html-report

outdir="${project.dir}/build/clover-report"

title="JGraLab Clover Report" />

</target>

To generate a new report, we just run:

ant with.clover build test clover.html

My question is: How can we exclude several classes/packages from the report generation?

For example, we don't want to have our test classes listed in the report. Currently, some non-JUnit test classes show up as top project risks, which is clearly wrong.

Likewise, we want to exclude several packages that contain only classes and interfaces generated by our code generator. The code generator is well-tested, so we may assume its output is correct and there's no need to cover everything it has generated.

2 answers

1 accepted

0 vote

You don't want to exclude test classes from your report. Really, you don't! You want to partition the reports into test code and non-test code. This way the top risks will be restricted to the non-test code.

Check out the <testsources/> element for <clover-report/> & <clover-html-report/> http://confluence.atlassian.com/display/CLOVER/clover-report#clover-report-Testsources

To filter out individual packages, try out the <fileset/> element

http://confluence.atlassian.com/display/CLOVER/clover-report#clover-report-Fileset

Thanks Michael,

that did the trick. :-)

Hi...

sorry, but how this filter works with maven?

my pom is:

<plugin>

<groupId>com.atlassian.maven.plugins</groupId>

<artifactId>maven-clover2-plugin</artifactId>

<configuration>

<excludes>

<exclude>nothing here is working, even "*.java"</exclude>

</excludes>

</configuration>

</plugin>

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 3 hours ago in Hipchat

Moving from Hipchat to Stride? Here’s what you’ll love

Heya, Hipchat friends! We’re so happy you’re checking out   Stride. Whether you know it or not, you have been instrumental in making Stride come to life. Every feature, design, and functionality...

15 views 0 1
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