4

Suppose I have a unit test project UnitTests.dll:

using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace UnitTests
{
    [TestClass]
    public class MyTests
    {
        [TestMethod]
        public void TestMethod1()
        {
            Assert.IsTrue(true);
        }

        [TestMethod]
        public void TestMethod2()
        {
            Assert.IsTrue(false);
        } 
    }
}

I would like to run the above unit tests programmatically from another project RunUniTests.exe. How do I do that? Something that's similar to NUnit counterpart such as the one shown in How to run NUnit programmatically would be great.

Community
  • 1
  • 1
Jason L
  • 510
  • 5
  • 16

1 Answers1

4

You can use command line to run it programmatically

"C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\MSTest.exe" /testmetadata:"vsmdiFile" /testsettings:

Milan Raval
  • 1,880
  • 1
  • 16
  • 33