Visual Studio 2012 cannot find my tests

I added the "Unit Test Library" project to my solution containing a simple test class:

namespace Metro_test { [TestClass] public class UnitTest1 { [TestMethod] public void TestMethod1() { Assert.Equals(0, 1); } } } 

But I can not do the test in the text explorer window. I tried to clear / restore the solution, delete / re-add links to MSTest, and edit the .csproj file to make sure the project is marked as a test project.

The whole solution is under source control, and my colleague (working with the same code) has no problems running the test.

Any ideas?

+6
source share
2 answers

Try adding a link to Microsoft.VisualStudio.QualityTools.UnitTestFramework, which can be found in C: \ Program Files (x86) \ Microsoft Visual Studio 11.0 \ Common7 \ IDE \ PublicAssemblies

Then, also make sure that you are using the assemblies to which you added the link.

 using Microsoft.VisualStudio.TestTools.UnitTesting; 

and delete the old

 using Microsoft.VisualStudio.TestPlatform.UnitTestFramework; 

EDIT

You can also just upgrade your visual studio to update 3, which should solve this problem.

+4
source

I had the same problem when updating a solution from VS 2010 to 2012. All tests have been canceled. I overcame this by deleting the old solution file (VS2010). Then I created a new one using VS2012, and added all the projects to the new solution. After rebuilding, all tests appeared in the test explorer.

0
source

Source: https://habr.com/ru/post/951094/


All Articles