Can't get Coverage File output
Can't get Coverage File output
Hi,
I can't seem to get the coverage file (CommonTests.NCover.xml) to output. Here is my NCover.Settings file:
<?xml version="1.0" encoding="utf-8"?>
<ProfilerSettings>
<CommandLineExe>C:\Program Files\NUnit 2.2.6\bin\nunit-console</CommandLineExe>
<CommandLineArgs>F:\Build\bin\Debug\CommonTests.dll /xml=F:\Build\bin\Debug\TestResults\CommonTests.NUnit.xml</CommandLineArgs>
<WorkingDirectory />
<Assemblies>F:\Build\bin\Debug\Common</Assemblies>
<CoverageFile>F:\Build\bin\Debug\TestResults\CommonTests.NCover.xml</CoverageFile>
<LogFile>F:\Build\bin\Debug\TestResults\CommonTests.NCover.Log.txt</LogFile>
<VerboseLog>false</VerboseLog>
<NoLog>false</NoLog>
<NoXslCopy>false</NoXslCopy>
</ProfilerSettings>
Any ideas?
Cheers,
r/
Re: NCover is alway reporting 100% test coverage?
Steve,
I haven't used MSTest but I have heard there are issues depending on how you run it. Speaking from second hand memory here but I believe that by default MSTest launches a separate executable process to run the tests in (VSTestHost.exe). This causes NCover a problem as it does not know that it should be profiling that process rather than MSTest.
Prior to NCover 1.5.8 I think there was a workaround for MSTest which told it to run the tests in it's own process. However this meant you couldnt have separate configuration files per test assembly.
As of NCover 1.5.8 there is now a //pm argument which you can use to indicate the name of the executable to profile. I havent used it myself but I know Jay Flowers has and he said it worked fine. I added support for it with a new optional attribute in the NAnt/MSBuild tasks but havent publicly linked to it - you can download from here:
http://www.kiwidude.com/dotnet/NCoverExplorer.Extras-1.3.6.14.zip
All of this info is second-hand from Jay but I'm sure there are others who know more than me...
Re: NCover is alway reporting 100% test coverage?
Thanks for the //pm tip Grant. Now instead of get no test coverage (my original post was incorrect. I was getting 100% "red", no coverage) I'm getting less than 1% test coverage. This isn't correct because MS block% test coverage is about 45%. Below is my command line call. Any other suggestions?
Thanks again,
Steve
"C:\Program Files\NCover\NCover.Console" mstest /runconfig:devportestrun.testrunconfig /testcontainer:CoreTest\bin\Debug\CoreTest.dll /resultsfile:test.trx //a Core //pm VSTestHost.exe
Re: NCover is alway reporting 100% test coverage?
Re: NCover is alway reporting 100% test coverage?
So this is now working using the command you posted here?
"C:\Program Files\NCover\NCover.Console" mstest /runconfig:devportestrun.testrunconfig /testcontainer:CoreTest\bin\Debug\CoreTest.dll /resultsfile:test.trx //a Core //pm VSTestHost.exe
I have also removed all "artifacts to instrument" in Visual Studio. When I try to run NCover with the same parameters as you are doing I get an almost empty coverage.xml file:
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet href="coverage.xsl" type="text/xsl"?>
<!-- saved from url=(0022)http://www.ncover.org/ -->
<coverage profilerVersion="1.5.8 Beta" driverVersion="1.5.8.0" startTime="2007-05-08T15:45:16.326018+02:00" measureTime="2007-05-08T15:46:05.0919551+02:00">
</coverage>
Without the //pm VSTestHost.exe I only get 0%.
Any ideas?
Re: NCover is alway reporting 100% test coverage?
Have you run through all the standard suggestions as listed here:
http://www.kiwidude.com/blog/2007/04/ncover-problems-fixes-part-2.html