Getting Code Coverage to Work in Visual Studio

Are you sick of seeing this error?:

"Code coverage is not enabled for this test run"

I was working on a project where my COV results were always giving the above error, and it took some figuring out. Basically, it came down to two things:

  1. I had the following setting switched off, so I wasn't being warned.
  2. I was using Ctrl+R, Ctrl+A to run my tests. That puts them in Debug mode (which isn't supported with COV), and which I had never realized. I should have been using Ctrl+R, A (ie; taking my finger off the Ctrl key before pressing 'A').

You live, you facepalm, you learn.

 

Avi