In Visual Studio, I just created a simple Unit Test to test a method I wrote. I wanted to check the code coverage, but the Code Coverage window only ever states that "Code Coverage is not enabled for this test run". Why? Note:
- I've already followed the instructions on this page, i.e. the test configuration does have the relevant assemblies checked on the Code Coverage options page.
- I've clicked "Run test", not "Debug test", which some sources claim causes this.
- I've tried running the test with the current build configuration set to either "Debug" or "Release"; neither works.
- I've also followed the suggestions on this page (re-select the testrunconfig file by selecting Test => Select Active Test Run Configuration), to no avail.
Yet I still get the message "Code Coverage is not enabled for this test run" every time I run the relevant test. How do I enable Code Coverage once and for all?