問(wèn)題描述
我正在使用 TFS 2012 從 Visual Studio 2015 構(gòu)建和部署解決方案,沒(méi)有任何問(wèn)題.我決定將我的單元測(cè)試作為構(gòu)建過(guò)程的先決條件的一部分.
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.
獨(dú)立于 msbuild 過(guò)程,單元測(cè)試運(yùn)行沒(méi)有問(wèn)題并成功;但是,當(dāng)我將它們合并為構(gòu)建過(guò)程的一部分時(shí),我的構(gòu)建中出現(xiàn)以下異常:
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.
構(gòu)建部分成功.
為了確保運(yùn)行測(cè)試,我已將 Process 中的 Disable Tests 屬性設(shè)置為 false:
In order to make sure that tests are run, I've set the Disable Tests property within Process to false:
除此之外,我還為自動(dòng)化測(cè)試設(shè)置了選項(xiàng):
唯一可用的測(cè)試運(yùn)行器如下:
The only test runners which are available are as follows:
另外,根據(jù)我的擴(kuò)展和更新,這表明我確實(shí)安裝了 nunit 適配器 3:
also, per my extensions and updates, it is showing that I indeed DO have nunit adapter 3 installed:
我做錯(cuò)了什么?為什么我的構(gòu)建只能部分成功?
推薦答案
通過(guò) NuGet 使用 NUnit 3 時(shí),我在構(gòu)建服務(wù)器上遇到了同樣的問(wèn)題.我從 Visual Studio 中卸載了 NUnit 2 和 3 測(cè)試適配器,并從機(jī)器上卸載了 NUnit 2.我仍然有問(wèn)題.
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.
在我的情況下,問(wèn)題是由隱藏在 4 個(gè) 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 構(gòu)建就會(huì)完美執(zhí)行.
As soon as they were deleted the TFS build executed perfectly.
這篇關(guān)于nunit 僅在作為 tfs msbuild 進(jìn)程的一部分運(yùn)行時(shí)才測(cè)試拋出異常的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!