Thursday, June 22, 2017

Test Explorer Discovery Fails Unless Run As Administrator in Visual Studio 2017

Leave a Comment

I am running Visual Studio 2017 & the Test Runner cannot discover the Unit Tests unless Visual Studio is running as an Administrator. Running as Administrator is next to impossible at my new workplace.

As such...

Q: How can get the Test Explorer to discover Unit Tests without being an administrator?

enter image description here

UPDATE:
I have confirmed the following...

  • POSITIVE: The Unit Test Project is set to build
  • POSITIVE: The Test Project is a genuine Unit Test Project (w/ magic guids)
  • NEGATIVE: The Test View is not an available option in VS2017 Community Edition

enter image description here

1 Answers

Answers 1

A summary of various fixes for this no tests found issue.

Make sure that your test project is set to build. If the test assembly isn't being built, VS won't be able to find any tests: enter image description here


Magic GUIDs are needed in the Test Project:

C#:

{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}   

VB:

{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{F184B08F-C81C-45F6-A57F-5ABD9991F28F} 

enter image description here


Trying to get ignored tests running again. Same error message occurs if you remove the Ignore label. Does not automatically re-enable the test. This article takes you through the last step. http://richallen.blogspot.com/2008/05/ms-test-re-enabling-ignored-tests.html


Make sure your method belongs to a class with the [TestClass] Attribute and the method it's marked with the [TestMethod] Attribute.


  • Use Test View to find your test. Test View
  • Open your Properties window (F4), and make sure your test is enabled Enabled

Some people have accidentially added a Class Library project instead of Test Project. Running Tests in a Class Library doesn't work, it has to be a Test Project , probably because of the Magic GUIDs.


Check whether the solution is running on 64bit. If so change it to x86.


Marking tests as static makes them fail to appear in the test list.


Close down Visual Studio and delete the .vsmdi (visual studio test meta data) file. This will be regenerated.

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment