Coverage problem with TestDriven and NCover

Coverage problem with TestDriven and NCover

I'm using NCover 5.8 via TestDriven 2.6 in Game Studio Express and I've run into an odd issue with coverage which I repro below:

using System;
using Microsoft.Xna.Framework.Input;
using NUnit.Framework;

namespace Repro {
    [TestFixture]
    public class OhNoesRepro {
        [Test]
        public void BreaksCoverage() {
            Assert.AreEqual(new KeyboardState(), new KeyboardState());
        }

        [Test]
        public void DoesNotBreakCoverage() {
            Assert.IsTrue(true);
        }
    }
}

If you perform a TestDriven Run Tests on this class, you'll get two passing tests.  However, if you run with coverage you get an empty coverage window and corresponding empty coverage.xml.  If you comment out the BreaksCoverage method, the other test will run and you will get coverage.

Any clues what's happening here, is the lack of pdb's with the XNA assemblies causing this?  If so, is there any workaround?



Re: coverage.xml file empty

Sounds like you need to do a google for what .pdbs are if you don't understand those. When you compile a debug build using the Visual Studio IDE (or with the csc command line using /debug from memory) in your output folder you should have both the executables/dlls and a .pdb file for each assembly in your solution. These .pdb files are used by debuggers to reconcile line numbers in the source code files with "sequence points" in the actual compiled dlls/exes.

NCover needs the .pdbs to generate the code coverage information for the same reason. So if the TestXXX.dll (and the dlls it call) do not have their respective .pdb files present in the same folder as the .dll exists in then NCover wont produce any coverage information for it.


Re: coverage.xml file empty


ok, thanks for your reply

In my Nant build file, it was "debug=false" (I use CruiseControl.Net). Without debug, it works !

I can see Ncover in my dashboard (even if it is very little, without graphics)




Re: coverage.xml file empty

Hi mate,

Glad to hear you are up and running. In terms of enhancing the appearance in CC.Net, you should take a look at NCoverExplorer and the "Extras" zip which contains custom stylesheets etc. Look back through the NCoverExplorer entries on my blog and you will find examples etc. Also a google will find the odd tutorial on setting it up. Using those stylesheets in combination with the ncoverexplorer.console.exe gives you the ability to produce "pretty" summary reports.