NCover through Cruise Control won't exclude

NCover through Cruise Control won't exclude

We're running a continuous build process using Cruise Control and MSBuild with NUnit 2.4 and NCover 1.5.8. I've got two attributes set up to be excluded from NCover: one of my own and System.CodeDom.Compiler.GeneratedCodeAttribute.

When I run the NCover process on my development machine it excludes everything it should but when it's run by Cruise Control on the build machine nothing is excluded!

The command on my dev machine is:

"C:\Program Files\NCover\NCover.Console.exe" "C:\Program Files\NUnit 2.4\bin\nunit-console.exe" /xml:"Application.tests.xml" "C:\CMS\Application\Build\Application.nunit" //q //ea "IRS.Common.NCoverExclude;System.CodeDom.Compiler.GeneratedCodeAttribute" //x "Application.Coverage.xml"

and on the build machine it's:

"%22C:\Program Files\NCover\NCover.Console.exe%22 %22C:\Program Files\NUnit 2.4\bin\nunit-console.exe%22 /xml:%22$(CCNetArtifactDirectory)\Application.tests.xml%22 %22$(CCNetWorkingDirectory)\Build\Application.nunit%22 //q //ea %22IRS.Common.NCoverExclude;System.CodeDom.Compiler.GeneratedCodeAttribute%22 //x %22$(CCNetArtifactDirectory)\Application.Coverage.xml%22"

The output is identical except for the paths for the output files.

Any idea what could be causing the difference?


RE: NCover through Cruise Control won't exclude

Okay, an update after more investigation.

After looking at the raw XML output of the NCover run on the build machine it turns out it is excluding everything after all! The problem is that the XSL included with CC.NET isn't taking the excluded functions into account.

Does anyone have an XSL that counts excluded code as being covered?


RE: NCover through Cruise Control won't exclude

Craig,

I'm very sorry about the delay in response. I'm working on your issue, and should have a fix for you fairly soon.

Alan Johnson NCover Team


RE: NCover through Cruise Control won't exclude

Craig,

What XSL stylesheet are you using? There are several floating around (we include a few with NCover, and CCNet has its own as well).

Thanks, Alan NCover Team


RE: NCover through Cruise Control won't exclude

Hi,

Is there any news on this? I have the same problem. I'm using the standard xsl files that came with Cruisecontrol.NET


RE: NCover through Cruise Control won't exclude

the recent versions of cc.net 1.4.4+ look like they've fixed this problem


RE: NCover through Cruise Control won't exclude

I beg to differ :) I have 1.4.4 SP1 and I'm getting the exact same problem.


RE: NCover through Cruise Control won't exclude

I know that NCover 2 and 3 ship with an xsl file but I am not sure about NCover v1.5.8.

Have you looked at the coverage file to verify the data is excluded?

Joe Feser


RE: NCover through Cruise Control won't exclude

I also have this problem. Coverage files do show the XML node as excluded. I'm guessing that the coverage XSL file in CC.NET is not removing these from it's calculation. I'll look for a modified version - if I don't find one I'll post my modified version.


RE: NCover through Cruise Control won't exclude

Here is my solution to this problem:

Go to the installation folder of CruiseControl.NET and locate the webdashboard\xsl folder. On my server this is located here: C:\Program Files\CruiseControl.NET\webdashboard\xsl

Edit the NCoverSummary.xsl file.

Change this:

<xsl:variable name="uncovered.lines" select="count(//coverage/module/method/seqpnt[@visitcount = 0])" />

to this:

<xsl:variable name="uncovered.lines" select="count(//coverage/module/method/seqpnt[@visitcount = 0][@excluded='false'])" />

Save the file.

Refresh the CC.NET page.

Job done!