Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

nunit tests throwing exception only when run as part of tfs msbuild process

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.

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.

The build partially succeeds.

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

enter image description here

In addition to this I've set options for Automated Tests:

enter image description here

The only test runners which are available are as follows:

enter image description here

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

enter image description here

What am I doing wrong? Why does my build only partially succeed?

like image 486
Alex Gordon Avatar asked Feb 04 '16 02:02

Alex Gordon


2 Answers

The message indicates that you are trying to run NUnit tests using the wrong Visual Studio adapter. Use the 2.0 adapter for NUnit 2.x tests and the 3.0 adapter for NUnit 3.0 tests.

If you have both adapters installed, each one will run the tests for which they are designed. Each of them will display a message in for any assembly that they do not support. The message isn't meant to be an error and we try to word it in such a way that it won't be taken as such. However, we felt we have to give it just in case you expected the assembly to be handled by that particular adapter. Passing it by silently seems wrong.

When running under the VS IDE, the message does not cause a failure in the test run. It appears that running under TFS does cause a failure. If memory serves, we fixed this problem for the NUnit 3 adapter but not (yet) for the NUnit 2 adapter.

like image 183
Charlie Avatar answered Oct 04 '22 22:10

Charlie


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.

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

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

like image 36
Mark Willis Avatar answered Oct 04 '22 20:10

Mark Willis