I have an example project, which contains 6 test cases: 5 passing and 1 failing. I does not found how to create per-test case report and because of that I have executed following command for every test case:
mvn clean clover:setup test -Dtest=%TEST_NAME%;
mvn clover:aggregate clover:clover;
It works fine for all test, but the failing test report does not contain a code coverage (count is always zero). When the failing test case is executed together with passing test case, the report is correct.
1. Is it expected behaviour?
2. Does it exist some another solution to generate for every test case a new report file with code coverage? Maybe it is possible to access the clover.db using some standard library in python/java/whatever?
The per-test coverage in simple builds is enabled when test sources are instrumented. This can be achieved by setting includesTestSourceRoots=true, it's enabled by default so I suppose either you've turned it off or tests are in some different module.
For more complex builds, when there's an application server and tests run outside this server (e.g. app server and REST tests) it's a little bit more complicated to set up the per tests coverage, you'll need to set up distributed per-test coverage then.
Regarding, your original question regarding failing tests. Yes, if test is failing Clover won't include its contribution to overall coverage stats. The reasoning behind this behavior is that since the test fails, its not trustworthy to say it provide test coverage (confidence) to your code.
In case you still want to include coverage from failing tests, you can do it by:
* Setting up an reportDescriptor in Maven project
* Configuring reportDescriptor to includeFailedTestCoverage
Thanks for signing up for Jira Ops! I’m Matt Ryall, leader for the Jira Ops product team at Atlassian. Since this is a brand new product, we’ll be delivering improvements quickly and sharing updates...
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!
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