0

我正在使用 NUnit 3.0 beta 对 Jenkins 进行测试。它在我的本地项目上运行良好,但是当我将它放在 Jenkins 系统上时,我得到了如下所示的 XML 结果

<test-results name="" total="0" errors="0" failures="0" not-run="0" inconclusive="0" ignored="0" skipped="0" invalid="0" date="2016-03-02" time="15:54:20">
<environment nunit-version="1.0.0.0" clr-version="4.0" os-version="Microsoft Windows NT" platform="Win32NT" cwd="M:\Works" machine-name="test" user="admin" user-domain="test"/>
<culture-info current-culture="en-US" current-uiculture="en-US"/>
<test-suite type="Assembly" name="EndpointBaseFramework.dll" executed="False" result="Success">
<properties>
<property name="_SKIPREASON" value="Constructor on type 'NUnit.Framework.Api.FrameworkController' not found."/>
</properties>
<reason>
<message>
<![CDATA[
Constructor on type 'NUnit.Framework.Api.FrameworkController' not found.
]]>
</message>
</reason>
<results/>
</test-suite>
</test-results>

这个错误的原因是什么?

4

1 回答 1

0

NUnit 3 已经发布了大约 6 个月。您确定您使用的是其中一个测试版而不是 3.0.1 吗?

Jenkins 的 NUnit 插件最后一次更新是在2015 年6 月,远在 NUnit 3 发布之前,并且源代码在10 个月内没有更新。NUnit 3 是重写的,你不能使用旧的 NUnit 2 运行器来运行它。

在插件更新为支持 NUnit 3 之前,您需要使用 NUnit3 Console Runner 运行测试。我会将NUnit.Console NuGet 包添加到您的解决方案中。这会将 nunit3-console.exe 拉到你的包目录中。从那里,在 Jenkins 中创建一个后期构建步骤,以在您的测试程序集上执行 nunit3-console.exe。有关命令行选项,请参阅NUnit 文档。

于 2016-03-02T18:39:00.103 回答