2009-12-24 86 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