Clover 2 introduces the ability to integrate Unit Test results and per-test coverage information into Coverage reports. This unique feature gives you a powerful insight into how well tested your covered code actually is, by showing you exactly which statements each of your tests cover. |
<clover-setup> task.If you are using a testing framework which does not use Junit or TestNG conventions for determining test methods, the nested <testsources/> element of <clover-setup> and <clover-instr> will allow you to specify the convention used by your framework.
The Instinct framework for example uses the following:
<clover-setup>
<testsources dir="tests">
<testclass>
<testmethod annotation="Specification"/>
<testmethod name="^should.*"/>
<testmethod name="^must.*"/>
</testclass>
</testsources>
</clover-setup>
|
You can optionally group <testclass/> definitions in <or/> or <and/> elements. Each <testmethod/> element is automatically grouped by an OR.
<clover-setup>
<testsources dir="tests">
<or>
<testclass name=".*Context">
<testmethod annotation="Specification"/>
</testclass>
<testclass name=".*Test">
<testmethod name="test.*"/>
</testclass>
</or>
</testsources>
</clover-setup>
|
Clover does its best to record your test results in the Clover database. In some instances however, Clover can not always do so. Currently unit tests using @Test (expected=Exception.class) annotations will be marked as failed when in fact the test passed. To integrate these test results into your Clover reports follow these steps:
<junit> task, you need to add an XML result formatter:
<property name="testreport.dir" value="build/test-reports">
<junit ...>
...
<formatter type="xml"/>
<batchtest todir="${testreport.dir}">
...
</batchtest>
</junit>
|
<testresults> element at report time.<testresults> element is specified, <clover-report> and similar tasks will use these results instead of those collected by Clover. Clover's test result collection may also be switched off via the dontRecordTestResults attribute on <clover-setup> or <clover-instr>.e.g.
<testresults dir="test-results" include="TEST-*.xml"/>
|
Clover's per-test coverage collection does not support parallel test execution.