I have a c# solution with the following structure:
mySolution
myProject
myProject.MSTests
References
Microsoft.VisualStudio.QualityTools.UnitTe
this is typical problem i have faced too. but the easiest solution I followed as my own is...just to build the project once and rebuild it again. so that you can resolve it.
This could be another reason. Check whether the solution is running on 64bit. If so change it to x86.
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:
[TestClass]
and that it's both marked [TestMethod]
, and NOT using the attribute [Ignore]
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
{
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>
Had this same issue but reading over the previous answers, everything looked good.
In my case, I had just run the test suite made a small change, built the solution and tried to run the test. No go. I tried building a couple more times and looking for problems other people had tried. Still no go.
I hit enter in one of my test methods to add a new and hit F6 to build the solution and clicked run Unit Tests.
Bingo! Everything ran smoothly.