Guidance for running tests using MSTest v1 in Visual Studio 2017 15.8.1

SvenAelterman picture SvenAelterman · Aug 19, 2018 · Viewed 13.3k times · Source

I upgraded to Visual Studio 2017 last week. A solution with several test projects using MSTest v1 seemed to be fine at first. Most test projects execute tests fine. This is .NET Framework, not .NET Core.

However, there is one project where I am encountering issues. It's an integration test project, meaning it runs web application tests using the ChromeDriver and Selenium. This project references NUnit, though that reference comes from another project reference. I am not actually using NUnit as my test framework.

This is the error when trying to run any test in that particular test project: Could not find test executor with URI 'executor://mstestadapter/v1'. Make sure that the test executor is installed and supports .net runtime version . Test project {name} does not reference any .NET NuGet adapter. Test discovery or execution might not work for this project. It's recommended to reference NuGet test adapters in each test project in the solution.

Disabling the option indicated below made everything work: Screen shot of Visual Studio 2017 Options, Test setting.

I found this solution after browsing the preview release notes at https://docs.microsoft.com/en-us/visualstudio/releasenotes/vs2017-preview-relnotes#--visual-studio-2017-version-158-preview-4 (scroll down to "... What's New ..." and then .NET Test Adapter Extension). It mentions this breaking change (though it didn't break my other projects), but there is no mention of what to actually do to solve the problem.

Of course, long-term, keeping that option unchecked doesn't seem feasible. So I am looking for guidance on how to proceed.

I already tried to see if I could "quickly" upgrade to MSTest v2, but that had an issue because System.Runtime 4.1.2 couldn't be found. I tried adding System.Runtime 4.3.0 via NuGet, but that didn't solve the issue.

Answer

Caltor picture Caltor · Feb 18, 2019

I was getting a similar issue running Xamarin.UITests and resolved it by installing the "NUnit 2 Test Adapter" Extension in Visual Studio. In Visual Studio 2017 you do this from Tools > > Extensions and Updates... > Online > Search "NUnit Adapter" > click the NUnit 2 Test Adapter then the Download button to install. Restart Visual Studio when prompted to complete the installation.