lundi 30 mars 2015

Finding .NET code covered exclusively by a set of tests

For a suite of .NET tests (MSTest), is there a way to find code blocks that are covered exclusively by a particular subset of the tests (i.e. a single TestClass?)


Here's my scenario: I'm working in an old code base which has built up a large and slow suite of unit and integration tests over time. We'd like to reduce the overall runtime of the suite. One approach is reducing redundancy between integration tests and unit tests. In fact, there are likely integration tests that are completely redundant to some unit tests.


Here's what I'd like to do:



  1. Collect code coverage over the full suite of unit and integration tests.

  2. Find integration tests which don't cover any blocks not covered by other tests.

  3. Manually validate that the reported tests are completely redundant, and if so, remove them.


Our tests are written in MSTest and run using Visual Studio. I'm familiar with collecting code coverage, but I'm not sure how to query through it.


Aucun commentaire:

Enregistrer un commentaire