I have a c# solution with the following structure:
mySolution
myProject
myProject.MSTests
References
Microsoft.VisualStudio.QualityTools.UnitTe
Another one for googlers using NUnit, especially those who have migrated from MS Unit test to NUnit. Please remove the project type Guids that are identifying the project as MS Test project from the project file.
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
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 :-)
Do you have a VSMDI file in your solution? I believe this file is required (NOT VERIFIED).
None of the other answers worked for me. I kept getting the following message in the output window:
------ Discover test started ------
========== Discover test finished: 2 found (0:00:00.1310428) ==========
No tests found to run.
In my case, the problem only occurred after I created a new configuration called 0-Local. I had to add <DebugSymbols>true</DebugSymbols
to the relevant section of my csproj file, so it looks like this:
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == '0-Local|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\0-Local\</OutputPath>
</PropertyGroup>
I was receiving the same message and it turned out to be that I had my unit test project on a network drive. Once I moved it local it ran fine. Just something to try if you get this error. John
When you run into this issue, in Visual Studio, you have to create a Test Project. 1. Select Test in Tool bar and choose "New Test". Create your project and at this point create your test method. It should work after this point.