Jenkins生成nunit报告nunit

编程入门 行业动态 更新时间:2024-10-28 22:27:03
Jenkins生成nunit报告nunit-report.xml(Jenkins generate nunit report nunit-report.xml)

我已经将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=10000

Everytime 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=10000

However, when I execute:

nunit-console .\BBA\Sources\Projects\BbaUnitTests\bin\BbaUnitTests.dll /xml=.\BBA\Sources\BuildResults\nunit-result.xml /timeout=10000

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

更多推荐

本文发布于:2023-08-06 06:24:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1445062.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:报告   Jenkins   nunit

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!