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

Snapshot printer does not extract the source-file-to-relevant tests mapping Edited

I was able to generate a report with per-test mapping for my functional tests, but the snapshot printer does not reflect this mapping.

Am referring to https://community.atlassian.com/t5/Clover-questions/Is-there-a-supported-way-to-extract-the-source-file-to-relevant/qaq-p/301804 where I had seen it working. The snapshot printer gave "All files" section and "Hitting tests" which listed each source file being hit by its respective test cases.

 

I do not see it happening anymore. Am using a merged database to snapshot. The sections exist but under "All files" I see test java file names instead of product java file names. In fact, in the entire snapshot printer output, I do not see a single source code file names at all. All file names are just test names. Am using clover-4.4.1.jar for all my operations.

 

Has anything changed or am I missing something obvious @Marek Parfianowicz ?

2 answers

1 accepted

0 votes
Answer accepted

Hello,

1. As a first step please check if Clover correctly recognised your application and test classes. In the HTML report you shall see all business logic on the 'Application code' tab and all test classes on the 'Test code' tab.

2. Next, please check if you correctly collected per-test code coverage data. In the HTML report, pick few classes and check if you have correct tests listed in the 'Tests hitting this class' dialog.

3. Also please check if you don't have too many tests failing. The reason is that by default Clover discards per-test code coverage from failed tests. You can change this setting, however. See 'includeFailedTestCoverage' option for <clover-report> (an Ant task) or clover:clover (Maven goal).

Once everything is OK, please try check how the clover:snapshot works.

4. Try to create coverage snapshots from individual modules, i.e. skip the database merge step. Do you see correct content there? If not, maybe coverage recording files are missing? They're usually named clover.db<some_hash> and clover.db<some_long_hash>.s

5. Finally, please test the merge task. Ensure you've provided all clover.db database files and coverage recording files.

Cheers
Marek

Step 4 was the clue.

Seems that the issue is due to the below TAG in my pom.xml

<cloverDatabase>${project.basedir}/clover_tests.db</cloverDatabase> 

Since I was giving a different path for test clover database, the clover:snapshot goal was not taking the command line override (neither -Dmaven.clover.cloverMergeDatabase nor -Dmaven.clover.cloverDatabase helped) to specify the merged database to be snapshotted.

 

To workaround the problem, I have created a local variable in pom and using that to override. During clover:merge and clover:clover, I do not pass the override and hence the report is generated correctly. During clover:snapshot, I pass the override and point it to the merged database.

 

Accepting this as answer since it led me to it.

0 votes

The most frequent issues are:

  • incorrect test patterns, so that tests files are not recognised as test code
  • missing code coverage data (e.g. tests were executed first on non-instrumented code)
  • discarded coverage because of failing tests
  • build setup mistakes, resulting in missing files (e.g. tests were executed on the remote machine, but coverage recording files not copied back for the report generation step)

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira

Jira Cloud Performance Improvements

Hello everyone, I am a product manager in the Jira Cloud team focused on making sure our customers have a delightful experience using our products. Towards that goal, one of the areas which is extr...

178 views 2 9
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