NCover from NAnt : Task helped, but no coverage information
NCover from NAnt : Task helped, but no coverage information
Hi
Back in February, I had cobbled together a NAnt script to run NCover on a set of NUnit tests. It ran for about a week, but our build changed and we decided it was going to be too difficult to maintain.
So today, when I decided I needed NCover statistics again, you can imagine how amped I was to see there is now an NCover task availble! I downloaded the task and set it up. Then downloaded the NantContrib task to get <trycatch>. But I set it up, and it seems to work. There are no failures, but I get no coverage information.
Actually, it wasn't quite that easy. At first everytime I ran my NUnit tests inside of NCover I got the "nunit-console.exe has done something naughty. report it to microsoft?" dialog box. I remember I was having this problem in February, but got past it somehow. Today I also got past it somehow without knowing exactly what changed. But in the meantime I had upgraded from NCover 1.3.3 and 1.5.4 and from NUnit 2.2.0 to NUnit 2.2.8.
Now, I can get it working perfectly from the command-line using this command:
E:\Work\dave\mySYSTEM5_0>ThirdParty\NCover\NCover.Console.exe ThirdParty\NUnit\V2.2.0.0\nunit-console.exe "Tests.dll" //l C:\coverage-output\logfile.txt //x c:\coverage-output\coveragexml.txt //w "src\mysystem\tests\unitoutput\Debug" //v
But the, at least as far as I can tell, equivalent NAnt task executes fine, reports no failures, but also provides no coverage information. It looks like this:
<ncover program="${project.fullpath}\ThirdParty\NCover\NCover.Console.exe"
commandLineExe="${nunit}"
commandLineArgs="Tests.dll /xml=${test.results.filename}"
workingDirectory="${test.unit.bin.dir}"
coverageFile="mycoverage.xml"
logFile="mycoverage.log"
logLevel="Verbose">
<assemblies basedir="${test.unit.bin.dir}">
<include name="Spot.*.dll"/>
</assemblies>
</ncover>
The Log file shows the assemblies being loaded with debugging symbols. The only unusual thing in the log is that the assemblies are in a temporary path, but I assume that is something NCover needs to do to instrument them. I've tried several obvious manipulations like getting rid of the <assemblies> block, or specifying one specific assembly.
It almost seems like the tests, when run from NAnt, link against uninstrumented assemblies, but I don't see how that could happen.
Help greatly appreciated, as always,
Dave