用户登录
用户注册

分享至

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

  • 作者: 天真64874497
  • 来源: 51数据库
  • 2023-02-13

问题描述

我正在使用 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.

软件
前端设计
程序设计
Java相关