2009-12-24 42 views
0

我不能为我的生活让我nant创建文件时测试失败而归(从而防止行驶时的包装和神器步骤)nunit2南特任务总是返回退出代码0(TeamCity的5.0)

终止

这是恶性文件的单位部分:

<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> 

而且不管什么真/假组合我设置haltonfailure,failonerror,failonfailureatend性能,结果总是这样:

[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 

请帮忙,因为我不想在单元测试失败的地方发布binarys!

TeamCity的5.0构建10669

AppMonApiTests.dll引用

nunit.framework.dll中v2.5.3.9345

单元未安装在构建服务器或GAC'd

使用Nant-0.85和Nantcontrib-0.85

个谢谢, 乔纳森

回答

0

这是我使用的目标,并终止如有测试失败:

<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> 

所以对于初学者来说,你可以尝试删除:

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

好像那些不应该导致问题,但是尝试获得一些基本的工作,然后你可以开始添加属性来查看是什么导致它停止工作。

+0

你好,删除这些属性没有区别。请记住,我没有使用nunit控制台,但我依靠TeamCity来取代nunit2任务。我没有使用任何nunit TeamCity插件或跑步者,所以运行测试的确实是一个谜团...... doco在这个整个区域有点贫穷和沮丧 – Jonathan 2009-12-24 12:38:38