Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

clover.xml does not contain code coverage for failing test case

Hi all,

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.

pom.xml:

<plugin>
<groupId>org.openclover</groupId>
<artifactId>clover-maven-plugin</artifactId>
<version>4.2.0</version>
<configuration>
<generatePdf>false</generatePdf>
<generateXml>true</generateXml>
<generateHtml>true</generateHtml>
<generateJson>false</generateJson>
</configuration>
<executions>
<execution>
<phase>pre-site</phase>
<goals>
<goal>instrument</goal>
</goals>
</execution>
</executions>
</plugin>

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?

Best regards

1 answer

0 votes

Hello,

 

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 

 

Cheers,

Grzegorz Lewandowski

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Marketplace Apps & Integrations

Learn how to request and manage app requests in the Marketplace

G’day everyone! Super exciting news coming from the Marketplace. We have now fully rolled out the ability for end-users to submit app requests to admins directly from within the product! No longer ...

10 views 0 2
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you