Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error when running unit tests in visual studio: Test-case objects missing

I'm getting the following error when running unit tests from visual studio using resharper:

Test-case objects missing for the following elements: ... Rebuild the project and try again

In the tooltip next to the unit test method it says: Inconclusive: Test not run and I think it said Unit test skipped at one point. Resharper shows a grey eye icon.

There's also a wierd issue with visual studio's Test Explorer. It won't show all my unit tests. In fact, it's missing over 200 of my unit tests. They just don't appear in the Test Explorer window. I do have a handful of tests that appear and will run just fine.

Things I've tried already: rebooting my machine, clean, rebuild, changing all dependent projects to use the same .net framework 4.7.

I'm using VS 2017 .net Framework 4.7, Resharper, and MSTest. All with the latest updates and versions.

like image 569
goku_da_master Avatar asked Feb 16 '18 17:02

goku_da_master


People also ask

How do I run unit test cases in Visual Studio?

Run tests in Test Explorer If Test Explorer is not visible, choose Test on the Visual Studio menu, choose Windows, and then choose Test Explorer (or press Ctrl + E, T). As you run, write, and rerun your tests, the Test Explorer displays the results in a default grouping of Project, Namespace, and Class.


1 Answers

I experienced this error after removing all nuget packages as I had changed my .net version and did not need any of them to compile.

After re-installing the MSTest.TestAdapter nuget package ReSharper started running my unit tests again as expected.

Install-Package MSTest.TestAdapter

like image 60
workabyte Avatar answered Sep 19 '22 14:09

workabyte