Is there a way to import a coverage snapshot and maintain the covering test information?

We have a large project with a mixture of legacy tests that are not well organized.  The tests can take a significant amount of time to complete.  My goal is to make use of Test Impact Analysis to shorten the feedback cycle at development time.

When I run “Cover All Tests From Solution” inside VS I then have the ability to open the Unit Test Coverage report and either right click on a class or right click in the code and see an option to “Show Covering Tests”.  From there I can create a test session containing just those tests.  This is very helpful.

However,  if I export that coverage snapshot and re-import it, that functionality is lost.  I can see the code coverage, but the ability to “Show Covering Tests” is gone.

My hope was to create coverage snapshots from the main branch that could then be imported into developer branches and used to identify Test Impact Analysis.  Individual developers could then run the impacted tests without having to tie up their development machines for extended times generating the initial test coverage.  Since re-importing…even into the exact same code that the snapshot was generated on…is losing the test line coverage, this doesn't work :(

Is there something I need to be doing on export/import to ensure the test line coverage remains available after an import?

The .dcvr file is binary.  Is there a specification/helper library somewhere that I can use to get the test line coverage information directly from the snapshot file (assuming it is saved in the snapshot file)?

Any insights on how to implement Test Impact Analysis by sharing snapshots/reports would be greatly appreciated!

 

Thanks!

 

 

0
2 comments

Hello Bjtieman,

Thank you for contacting JetBrains Support. I'm glad to work with you on this ticket. 

Currently, the "Show Covering Test" option is not supported for exported snapshots. This limitation will be addressed once the issue (DCVR-10305 Add ability to open saved coverage snapshots in Unit Tests Coverage window.) is resolved. This issue is a long-standing work item but has been prirotized. We're trying to address it in the scope of the 2025.2.x minor releases. Please note this timeline is tentative and may change. 

Workaround

You can export data from coverage snapshot using dotcover command line tool. To retrieve the details, use the report command with --ReportType XMLand IncludePerTestInfo Method parameters. Sample: dotcover report --source .\test.dcvr --output test.xml --reporttype xml --includePerTestInfo Method

Let me know if you have any further questions. 

Regards,

Tom
 

0

This is great Tom!  Thanks!!!

0

Please sign in to leave a comment.