NUnit VS Adapter do not discover tests due to FileNotFoundException, Exception converting tests

919 Views Asked by At

When trying to run tests via Visual Studio Test Explorer, I got following error for all tests in solution (those that use Typemock and those that don't):

[2/12/2018 11:35:36 AM Informational] NUnit VS Adapter 2.1.1.0 discovering tests is started [2/12/2018 11:35:37 AM Error] Exception System.IO.FileNotFoundException, Exception converting Manager.Tests.MessageLoggerTest.AddMessage_WhenAddMessageIsCalled_ThenAddMessagesToList ...

I found only one mention of the problem online on Xamarin forum, but with no fix (https://forums.xamarin.com/discussion/119513/xamarin-ui-tests-filenotfoundexception).

I use Visual Studio Enterprise 2017, version 15.5.6, NUnit 2.6.4, NUnitTestAdapter 2.1.1 and Typemock 8.6.0.22.

Running tests via Typemock runner (Test Navigator) works as expected.

EDIT

I feel a bit embarrassed, I cannot reproduce my original error. At work, we use multiple branches of the code base. Now, one branch works fine. I can discover and run tests via VS runner (Test Explorer).

On the other branch, when rebuild 1. test project I am getting StackOverflowException instead of FileNotFoundException. But it also discovers 41 of 43 tests that are in project. The 2. test project get also StackOverflowException and discovers none of 295 tests.

[2/20/2018 10:43:40 AM Informational] ------ Discover test started ------ [2/20/2018 10:43:44 AM Informational] NUnit VS Adapter 2.1.1.0 discovering tests is started [2/20/2018 10:43:54 AM Error] The active test discovery was aborted. Reason: Process is terminated due to StackOverflowException.

[2/20/2018 10:43:54 AM Informational] ========== Discover test finished: 41 found (0:00:13.8969695) ==========

Have compared solution file, project files and NuGet package configs. Only difference between the branches was packages.config line:

<package id="Typemock.Isolator" version="8.6.0.18" targetFramework="net452" />

The working branch have targetFramework="net452", failing branch had targetFramework="net462". However changing framework to net452 didn't help.

Will have to dig deeper to see, what makes the difference. Thanks for anyone's help and time.

2

There are 2 best solutions below

0
mclark1129 On

Try installing the NUnit 2 Test Adapter extension for Visual Studio from the gallery. This fixed the issue for me on a project also using NUnit 2.6.4.

0
uday augustin On

I have faced the same issue. In my case deleting temporary files in windows solved my issue.

Close visual studio. Go to Run and type %temp%. Clear all the files. Now the visual studio will discover all the UI test case.