nunit 仅在作为 tfs msbuild 进程的一部分运行时才测试抛出异常

时间:2023-02-18
本文介绍了nunit 仅在作为 tfs msbuild 进程的一部分运行时才测试抛出异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我正在使用 TFS 2012 从 Visual Studio 2015 构建和部署解决方案,没有任何问题.我决定将我的单元测试作为构建过程的先决条件的一部分.

I'm building and deploying a solution from Visual Studio 2015 using TFS 2012 without issues. I have decided to incorporate my unit tests as part of the prerequisites for the build process.

独立于 msbuild 过程,单元测试运行没有问题并成功;但是,当我将它们合并为构建过程的一部分时,我的构建中出现以下异常:

Independent of the msbuild process, the unit tests run without issue and succeed; however, when I incorporate them as part of my build process I am getting the following exception in my build:

Exception NUnit.Core.UnsupportedFrameworkException, Exception thrown executing tests in D:Builds4PA1111CEDev1111dBusinmmmTests.dll
 No test is available in D:Builds4PA1111CEDev1111dBusinmmmTests.dll. Make sure that installed test discoverers & executors, platform & framework version settings are appropriate and try again.

构建部分成功.

为了确保运行测试,我已将 Process 中的 Disable Tests 属性设置为 false:

In order to make sure that tests are run, I've set the Disable Tests property within Process to false:

除此之外,我还为自动化测试设置了选项:

唯一可用的测试运行器如下:

The only test runners which are available are as follows:

另外,根据我的扩展和更新,这表明我确实安装了 nunit 适配器 3:

also, per my extensions and updates, it is showing that I indeed DO have nunit adapter 3 installed:

我做错了什么?为什么我的构建只能部分成功?

推荐答案

通过 NuGet 使用 NUnit 3 时,我在构建服务器上遇到了同样的问题.我从 Visual Studio 中卸载了 NUnit 2 和 3 测试适配器,并从机器上卸载了 NUnit 2.我仍然有问题.

I had the same problem on my build server when using NUnit 3 via NuGet. I uninstalled NUnit 2 and 3 test adapters from Visual Studio, and NUnit 2 from the machine. I still had the problem.

在我的情况下,问题是由隐藏在 4 个 NUnit2 DLL 引起的:

In my case the issue was caused by 4 NUnit2 DLLs hiding in :

C:Program Files (x86)Microsoft Visual Studio 14.0Common7IDECommonExtensionsMicrosoftTestWindowExtensions

一旦它们被删除,TFS 构建就会完美执行.

As soon as they were deleted the TFS build executed perfectly.

这篇关于nunit 仅在作为 tfs msbuild 进程的一部分运行时才测试抛出异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

上一篇:从 AssemblyInfo 后编译读取 AssemblyFileVersion 下一篇:如何在 OS X 和 Linux 上安装 MSBuild?

相关文章

最新文章