开发者

nunit2 Nant task always returns exit code 0 (TeamCity 5.0)

I just cannot for the life of me get my nant build file to terminate upon a test failure and return (thus preventing the packaging and artifact step from running)

This is the unit part of the nant file:

<target name="unittest" depends="build">
  <nunit2 verbose="true" haltonfailure="false" failonerror="true" failonfailureatend="true">
   <formatter type="Xml" />
   <test assemblyname="Code\AppMonApiTests\bin\Release\AppMonApiTests.dll" />
  </nunit2>
</target>

And regardless what combination of true/false i set the haltonfailure, failonerror, failonfailureatend properties to, the result is always this:

[11:15:09]: Some tests has failed in C:\Build\TeamCity\buildAgent\work\ba5b94566a814a34\Code\AppMonApiTests\bin\Release\AppMonApiTests.dll, tests run terminated. 
[11:15:09]: NUnit Launcher exited with code: 1
[11:15:09]: Exit code 0 will be returned.1

Please help as i don't want to be publishing binarys where the unit tests have failed!!!

TeamCity 5.0 build 10669

AppMonApiTests.dll references

nunit.framework.dll v2.5.3.9345

unit isn't installed on the build server or GA开发者_开发知识库C'd

Using Nant-0.85 and Nantcontrib-0.85

Thanks, Jonathan


This is the target I use and it terminates if any tests fail:

<target name="test" depends="compile_tests,copy_dependencies">
    <mkdir dir="${testlogdir}"/>

    <echo message="Please make sure that nunit-console is in your path."/>
    <echo message="This file can be found in the NUnit bin directory."/>

    <nunit2 verbose="true">
        <formatter type="Xml" usefile="true" outputdir="${testlogdir}" extension=".xml"/>
        <formatter type="Plain" usefile="true" outputdir="${testlogdir}" extension=".txt"/>
        <test assemblyname="${build_classdir}\${namespace_file}.Test.dll"/>
    </nunit2>

</target>

So for starters, you could try removing:

haltonfailure="false" failonerror="true" failonfailureatend="true"

It seems like those shouldn't be causing a problem, but try to get something basic working, and then you can start adding in attributes to see what makes it stop working.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜