For some reason, every time that I want to enable code coverage for a library that I’m unit testing, I found hard to remember how to enable this fabulous feature.
Here are the steps (that work for me):
- Double click the [Local].testsettings file in the Solutions Items folder in the Solution Explorer window.
- In the "Test Settings" dialog, choose the "Data and Diagnostics" item.
- In the list of roles, select "Code Coverage" [Figure 1] and immediately click the ‘"Configure" button.
- In the "Code Coverage Detail" [Figure 2] dialog select the assemblies to instrument for code coverage.
- Run your test scenario and in the "Test Tools" toolbar, click the icon "Code Coverage Results".