Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2012 unable to find my tests

I have added a "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 am unable to make the test show up in the text explorer window. I have tried cleaning/rebuilding the solution, removing/re-adding references to MSTest and editing 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) is having no problem running the test.

Any ideas?

like image 457
Darajan Avatar asked Aug 06 '13 07:08

Darajan


People also ask

How do I enable test in Visual Studio?

To enable Live Unit Testing, select Test > Live Unit Testing > Start from the top-level Visual Studio menu.

Where is the test detail summary in Visual Studio?

You just need to hover your mouse at the bottom of Test Explorer and drag it up. You can see Test Details summary below of your test regardless of Run or Debug mode.

How do I add a test solution in Visual Studio?

Select the test project in Solution Explorer. On the Project menu, select Add Reference. In Reference Manager, select the Solution node under Projects. Select the code project you want to test, and then select OK.


1 Answers

Try adding a reference 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 that you added reference to.

using Microsoft.VisualStudio.TestTools.UnitTesting;

and remove the old

using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;

EDIT

You could also just update your visual studio to update 3, which should solve this problem

like image 108
Oreflow Avatar answered Oct 03 '22 20:10

Oreflow