MSTest: No tests are run because no tests are loaded or the selected tests are disabled

Solution 1:

Another one for the googlers - this one turned out to be my problem, and it's embarrassingly boneheaded of me. Make sure that your test project is set to build in whatever solution configuration you're using. If the test assembly isn't being built, VS won't be able to find any tests in the non-existent assembly, and you'll bang your head against the wall for a while :-)

Solution 2:

Possibly a bit late, but this question googles up well, I thought I'd throw some crumbs in for future googlers.

Bryan Cook suggests checking the ProjectTypeGuids in his blog post about Manually creating a MS Test Project. Apparently the magic GUIDs you need are {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} for c# and {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{F184B08F-C81C-45F6-A57F-5ABD9991F28F} for VB. See his blog post for more details.

In case the blog post ever goes away you need to add the following element in the main property group in the csproj file:

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

Solution 3:

Another idea for the Googlers out there. My problem was trying to get ignored tests running again. Same MS 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

Solution 4:

The fix is simple, even though it shouldn't be needed, if Visual Studio worked as it should.

To sum up what others have contributed, particularly in this article, here's what ultimately worked for me:

  • Use the Configuration Manager to make sure your test project is selected to build in whatever configuration and platform you're using (ex: configuration=Debug and platform=x86)
  • Make sure your method belongs to a [TestClass] and that it's both marked [TestMethod], and NOT using the attribute [Ignore]
  • Use Test View to find your test. Test View
  • Open your Properties window (F4), and make sure your test is enabled Enabled

Solution 5:

The original poster did do this, but I arrived here after not having done this:

Be sure that [TestClass] is declared at the top, public in scope:

namespace XYZ.API.Repository.Tests
{
    [TestClass()]
    public class ClientTests
    {