仅当作为tfs msbuild进程的一部分运行时,nunit测试才会引发异常 [英] nunit tests throwing exception only when run as part of tfs msbuild process
问题描述
我正在使用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:\Builds\4\PA1111CE\Dev1111dBus\bin\mmmTests.dll
No test is available in D:\Builds\4\PA1111CE\Dev1111dBus\bin\mmmTests.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:
除此之外,我还设置了自动测试的选项:
In addition to this I've set options for Automated Tests:
唯一可用的测试运行器如下:
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.
在我的情况下,此问题是由以下四个NUnit2 DLL引起的:
In my case the issue was caused by 4 NUnit2 DLLs hiding in :
C:\ Program Files(x86)\ Microsoft Visual Studio 14.0 \ Common7 \ IDE \ CommonExtensions \ Microsoft \ TestWindow \ Extensions
将它们删除后,TFS构建便会完美执行.
As soon as they were deleted the TFS build executed perfectly.
这篇关于仅当作为tfs msbuild进程的一部分运行时,nunit测试才会引发异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!