Windows service with unit tests

Windows service with unit tests

There is a fine article in the how-to section about 'Code Coverage of Windows Services'. I downloaded the example and tried to run 1. coverage analysis of a windows service and 2. coverage analysis of a windows service with additional unit tests.

The first part worked fine as described in the article. The second not. The article says:

...

NCover.Console.exe //svc EchoService nunit-console /noshadow TestEchoService\bin\Debug\TestEchoService.dll

This command line runs coverage on the echo service as before, but it also runs our test and stops collecting coverage once the tests have finished running.

...

I tried this with the EchoService example I've downloaded. The test is not running as described and stops when finished. Instead the service is waiting to be cancelled with Control-C as in step 1 (only coverage analysis of service).

Has anybody an idea why the code example is not running. I am working under Windows XP with NCover 3.3.2.6211 and NUnit 2.5.2.9222.

Thanks & Kind Regards


RE: Windows service with unit tests

The installers below should fix the problem.

http://files.ncover.com/NCover-x86-3.3.3.6317.msi http://files.ncover.com/NCover-x64-3.3.3.6317.msi


RE: Windows service with unit tests

Hello,

I tried also to run coverage on windows service only and windows service with unit tests with the provided version.

Problem with both cases is that I cannot get coverage results. First time after service is stopped and second time after tests are run I get same error message:

---- Top level exception: System.Exception No data was collected. at NCover.Framework.ProfilerDriver._GetCoverageData() at NCover.Framework.ProfilerDriver.ExecuteNCover(Int32& profiledAppCode) at NCover.Framework.ProfilerDriver.Execute(Int32& profiledAppCode)

at NCover.ConsoleMain.ConsoleMain.RunCoverage(String[] args, IOutputWriter output)

I use also Windows XP, Service Pack 3.

Thanks in advance Maria


RE: Windows service with unit tests

anyrom,

If the installers don't fix the problem, change the user account that the service is running as. NCover can't covers services running under the "LocalSystem" account in windows XP


RE: Windows service with unit tests

Thanks.

It did solve my problem. Now I can check coverage with windows service also.

Maria