我已经将Jenkins配置为运行nunit-console,如下所述: Execute NUnit with Jenkins 和这里: How do you run NUnit tests from Jenkins?
我添加了“执行批处理命令”作为构建步骤并输入以下值:
%nunit-console% .\BBA\Sources\Projects\BbaUnitTests\bin\BbaUnitTests.dll /xml=.\BBA\Sources\BuildResults\nunit-result.xml /timeout=10000
每次运行构建时,一切正常,直到进入此构建步骤, 此行显示并且无限期运行,并且不生成xml文件:
C:\BuildServerFiles\workspace\BBA-71>.\BBA\Sources\Projects\RngUnitTests\bin\BbaUnitTests.dll /xml=.\BBA\Sources\BuildResults\nunit-result.xml /timeout=10000
然而,当我执行:
nunit-console .\BBA\Sources\Projects\BbaUnitTests\bin\BbaUnitTests.dll /xml=.\BBA\Sources\BuildResults\nunit-result.xml /timeout=10000
从命令提示符它工作正常,xml文件生成正常。 这可能是什么问题?
答案 0 :(得分:0)
我已将此行添加到nant构建脚本,而不是向jenkins添加步骤:
formatter type="Xml" outputdir="${main-directory}\BuildResults\" usefile="true" extension=".xml"/>
实现目标:
<target name="build" description="Build Solution and run tests">
<echo message="Building the release configuration" />
<exec program="${msbuild}" commandline='"${my-solution}" /v:m /nologo /property:WarningLevel=0 /t:Rebuild /p:Configuration="Release" /p:Platform="Any CPU"' />
<echo message="Running unit tests" />
<nunit2>
<formatter type="Plain" />
<formatter type="Xml" outputdir="${main-directory}\BuildResults\" usefile="true" extension=".xml"/>
<test assemblyname="${main-directory}\Projects\MyUnitTests\bin\MyUnitTests.dll">
</test>
</nunit2>
</target>