問題描述
我正在使用 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 進程的一部分運行時才測試拋出異常的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!