Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 15.8.1 not running MS unit tests

People also ask

How do I run all unit tests in Visual Studio?

To run all the tests in a default group, choose the Run icon and then choose the group on the menu. Select the individual tests that you want to run, open the right-click menu for a selected test and then choose Run Selected Tests (or press Ctrl + R, T).

How do I enable test in Visual Studio?

To enable Live Unit Testing, select Test > Live Unit Testing > Start from the top-level Visual Studio menu.

How do I get unit test coverage in Visual Studio?

On the Test menu, select Analyze Code Coverage for All Tests. You can also run code coverage from the Test Explorer tool window. Show Code Coverage Coloring in the Code Coverage Results window.


Ok, you can add Nuget packages as asked. But you can also try to disable the following setting (Tools->Options->Test): "For improved performance, only use test adapters in test assembly folder or as specified in runsettings file".

Let me know if it works for you.


I had to add the following Nuget packages:

MSTest.TestAdapter
MSTest.TestFramework
Microsoft.NET.Test.Sdk

Visual Studio release notes


If you are using MS Test, try installing

MSTest.TestAdapter via nuget or

if you are using nunit, install

NUnit3TestAdapterlatest versions via nuget.

After installing please restart the visual studio and then you can see the tests running.


I had the same issue and none of the answers above worked. Installing NUnit3TestAdapter V3.10.0 fixed it.


I had a very similar issue recently with xUnit, the same outcome, however my fix was due to the fact that previously with lower versions of Microsoft.NET.Test.Sdk you didn't need XUnit.Runner.VisualStudio explicitly installed.

When I updated my Microsoft.NET.Test.Sdk to version 15.9.0 it stopped allowing tests to run until I installed the XUnit.Runner.VisualStudio Nuget.

Now, This may seem blatantly obvious, but, previously it would cope without it and still work. Now, it does not. The same will probably be true of other test platforms. It worked for me.


My reputation score does not currently allow me to add this as a comment to the accepted answer. For reference, I've appended version numbers to the nuget packages referenced in csharpsql's answer:

MSTest.TestAdapter v1.3.2
MSTest.TestFramework v1.3.2
Microsoft.NET.Test.Sdk v15.9.0