Welcome, Guest!

<ncover> nant task does not fail on unit test failure?

<ncover> nant task does not fail on unit test failure?

by forums on Tuesday September 18, 2007, 01:35 PM

Using:
ncover-1.5.8
ncoverexplorer-1.3.6.32
ncoverexplorer.extras-1.3.6.15
nunit-2.4.1
nant-0.85


Hi recently started using NCover and NCoverExplorer(.Extras) in my build - awesome stuff.


But I'm having an issue with the <ncover> nant task where it seems to continue even if a unit test fails.


I notice that in the example you give in the NCoverExplorer.Extras\examples\example.build, that you have a try/catch around the example call to <ncover>, presumably to allow tests to fail, but still report coverage.


I have not bothered with that yet but noticed that my build continues even with an NUnit test failure.


Here is my covered test target:


    <target name="test" description="Apply the unit tests with coverage">
        <ncover  program="${ncover.dir}\ncover.console.exe"
                 commandLineExe="${nunit.dir}\bin\nunit-console.exe"
                 commandLineArgs="${core.output}\${project.web.service}.Test.dll ${core.output}\${project.app}.Test.dll ${core.output}\${project.domain}.Test.dll /xml=${core.reports}\${solution.name}.Test.dll-results.xml"
                 coverageFile="${core.reports}\${solution.name}-coverage.xml"
                 failonerror="true"
                 >
        </ncover>
   
        <call target="test.report"/>
    </target>


Not sure whether I'm doing something wrong or if this is a bug in the <ncover> nant task?