Chris Herring
Chris Herring

Reputation: 3665

How to find the unit tests

I have a bunch of unit tests in my visual studio project and code coverage coloring shows the covered lines of code in blue. Is it possible to jump to the unit test(s) that covers that line of code?

Upvotes: 2

Views: 104

Answers (2)

Garry Shutler
Garry Shutler

Reputation: 32698

An alternative method is to change that line of code, maybe comment it out, and see which tests fail as a result. May well be quicker than having to manually check each time the breakpoint is hit.

Upvotes: 1

Simon P Stevens
Simon P Stevens

Reputation: 27499

No. Several unit tests may cover the same line, so it's not a 1-1 relationship.

Your best bet is to stick a breakpoint on the line and run the tests and look at the call stack when the break point is hit.

Upvotes: 3

Related Questions