This is a problem we only found out after we’d sent off the DVDs to be pressed, and turns out to easy to repro, but also easy to workaround. It’s also got a slightly strange workflow compared to the way we think a lot of people will be using run configs initially.
If you enable code coverage and then subsequently disable it – all through the Edit Run Configuration dialog (or opening & saving from the Run test run config dialog), you will possibly find that when you run your tests you will see that the test result is error/fail and the message is “FileNotFoundException” or “MethodNotFound”.
How can you workaround this problem and get back to running your unit tests? Well, there are two ways:
a) Copy the localtestrun.rcg from the product directory over the one in your solution
b) Edit the .rcg file for your solution so that the XML element isNewLocalDeployment is set to false rather than true.
If you do either of these you will need to close your solution and re-open it to see the changes.
There is a simple way to avoid this happening. When working with run configuration, don’t use the “Edit Run Configuration” button on the toolbar to enable/disable code coverage. This is because using this dialog saves the changes to disk when you click OK & keep the changes. When you change settings in the Run Configuration dialog shown when you execute tests, the changes are only saved if you explicitly save them. Because of this subtle difference, you can change settings at runtime without screwing anything up.
Another option of source is to save the code coverage enabled runconfig to a separate file and just swap between them when you need to have or not have code coverage information.
One last thing on this topic – you may have a problem with a) because of another bug, which I’ll cover in another blogsicle.