我已经将Jenkins配置为运行nunit-console,如下所述: 使用Jenkins执行NUnit,并在此处: 如何从Jenkins运行NUnit测试?
我添加了“执行批处理命令”作为构建步骤并输入以下值:
%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文件生成正常。 这可能是什么问题?
I've configured Jenkins to run nunit-console as described here: Execute NUnit with Jenkins and here: How do you run NUnit tests from Jenkins?
I've added "Execute batch command" as a build step and entered the following values:
%nunit-console% .\BBA\Sources\Projects\BbaUnitTests\bin\BbaUnitTests.dll /xml=.\BBA\Sources\BuildResults\nunit-result.xml /timeout=10000Everytime I run a build, everything works ok until it gets to this build step, this line shows up and it runs indefinitely and no xml file is generated:
C:\BuildServerFiles\workspace\BBA-71>.\BBA\Sources\Projects\RngUnitTests\bin\BbaUnitTests.dll /xml=.\BBA\Sources\BuildResults\nunit-result.xml /timeout=10000However, when I execute:
nunit-console .\BBA\Sources\Projects\BbaUnitTests\bin\BbaUnitTests.dll /xml=.\BBA\Sources\BuildResults\nunit-result.xml /timeout=10000from command prompt it works ok, the xml file gets generated ok. What could be the possible issue here?
最满意答案
我已将此行添加到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>I've added this line to nant build script instead of adding a step to jenkins:
formatter type="Xml" outputdir="${main-directory}\BuildResults\" usefile="true" extension=".xml"/>Making it this:
<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>更多推荐
发布评论