December 0824

NCover on 64bit Vista

Today I started to work with NCover as part of my Unit Testing and instantly ran into problems. TBH I wasn't aware that I had NCover on my pc, but it is installed as part of a standard TestDriven.Net installation and invocable from a right click Test with... > Coverage. This then should let you know how much of your code is currently being covered by your testing, the idea being that you want as much of your code as is reasonable to be covered and this lets you know what is and isn't covered so you can increase your code coverage. My problem was that the version of NCover that is installed with TestDriven.Net is not suitable for 64bit Vista.

So when I tried to run the tests with coverage the Output window reported that the version I had wasn't for 64bit machines and said I'd have to download the 64bit enterprise version (with a 30 day trial key even on the beta - or buy it for $299 or about £200). Well I'm just starting out so I've gone for the 30 day trial - but I guess I'll need to fork out for this, or persuade my employer that this is a good idea and get a spare license for home.

Ok first hurdle overcome, so I've installed the 64bit version now can I run my tests with coverage? NO. Trying to do so the output window now tells me: "Running NCover requires Administrative privileges." I should be able to run it if I right click and run as Administrator - but this is executing from TestDriven.Net from within Visual Studio. I did find a glimmer of hope in Reggie's Ramblings but the advice to run the registration wizard as an Admin didn't make any difference. I still couldn't run my tests with coverage.

However running Visual Studio as an Administrator means it is calling NCover as an admin and so has appropriate privileges to invoke it. I am now able to run my tests and find out how much of my code is being covered - but only if I run Visual Studio as an admin. I guess the alternative is to switch off the Vista User Account Control (UAC), which is a pain in the ass most of the time anyway - but I've only recently reinstated it following a conversation with someone at work who managed to persuade me that it is a good idea and does fade into the background after a week or so of use.

Permalink | Comments (2)

Comments

  1. Alex United Kingdom Alex (Monday, December 29, 2008) #

    Nice article simon. Yup vista at its most annoying again. Same goes for running command prompt, always a good idea to right click and run as admin.

  2. SimonMartin United Kingdom SimonMartin (Tuesday, December 30, 2008) #

    Hi Alex,

    Something that I discovered whilst playing around a bit is that you can set the shortcuts so they always run as Admin, so you don't have to remember to do it each time. Right click the shortcut, go to Properties and under the Shortcut tab click the Advanced button and there's a tickbox right in there.

    Now your computer is "protected from unauthorised activity" but the program runs with admin rights.

Comments are closed