Test classes clover instrumentation

Is it mandatory/required to instrument test classes while implementing code coverage with clover ?

1 answer

1 accepted

0 votes
It's not. But when you don't instrument test classes you will not see per-test coverage in a report (i.e. only a global one)

Hey Marek!

Can you please help me to understand per-test coverage. When I dont instrument my test classes I get a meesage in report under Test Results column- "No test result could be found. Please ensure..."

Hi Ritesh,

This is exactly the point - because of the fact that test classes were not instrumented by Clover, Clover has no information about tests which were executed. That's why you see a "No test result could be found" message in the HTML report.

Pleae note that there's a possiblity to use JUnit's XML test result files. This is useful in case you're using a test framework not recognized by Clover. You have to use the <testresults> option of the <clover-report> task.

But unfortunately ... you still have to instrument your test classes (sic! but you can treat them as application classes i.e. to not record per-test coverage for them) ... the point is that Clover must attach test result from JUnit's XML file to a certain class and this class must exist in Clover's database.

Cheers
Marek

Hi Marek! Even if I instrument the tests I can t see them in the report. Here it s how I define where the tests are located :

<target name="coverage">

<clover-setup initstring="${coverage.merge.data.dir}/merged.db">

<testsources dir="path/to/test/dir/">

<include name="*.java" />

<include name="**/*.java" />

<testclass>

<testmethod name="test*"/>

</testclass>

</testsources>

</clover-setup>

Any obvious thing I m doing wrong please? Is there a way to debug if clover found any tests using the specified path? Thanks for all your help!

Suggest an answer

Log in or Join to answer
Community showcase
Teodora [Botron]
Published Thursday in Marketplace Apps

Jira Inferno: The Nine Circles of Jira Administration Hell

If you spend enough time as a Jira admin - whether you are managing a single, mid-sized instance, a large enterprise one or juggling multiple instances at once - you will eventually find yourself in ...

265 views 0 12
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot