No tests were run because no tests are loaded
How to solve the horrid No tests were run because no tests are loaded or the selected tests are disabled error when trying to unit test in Visual Studio 2010.
This error is very confusing and a search of Google reveals nothing of much value. I had this issue today and finally figured the issue out.
Turns out that background discovery of new test methods was disabled. How that happened I have no idea, but here’s how to turn it back on.
Go to Tools > Options
Navigate to Test Tools > Test Project and ensure the Disable background discovery of test methods checkbox is unchecked.
Restart Visual Studio and enjoy being able to unit test again!
在VS的Unit Test中遇到“No tests were run because no tests are loaded or the selected tests are disabled.”提示信息。同时,Test View和Test List Editor中无法加载任何Test。解决方案是:删掉 [TestClass()]和[TestMethod()],编译,重新加上这些Attributes后再编译。