How to run tests in the Visual Studio Test Extensions infrastructure ?

To run your tests with the Visual Studio Test Extensions infrastructure in your test project :
  • Add a reference to the PosInformatique.DevelopmentTools.VisualStudio.TestExtensions assembly. This assembly can be found in the installation directory (by default : C:\Program Files (x86)\P.O.S Informatique\Development Tools\
  • Replace the Microsoft TestClass attribute by the UnitTestClass attribute (do not forget to add the using statement for the Visual Studio Test Extensions) :

namespace PosInformatique.DevelopmentTools.VisualStudio.TestExtensions.Samples
{
    using System;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using PosInformatique.DevelopmentTools.VisualStudio.TestExtensions;

    [UnitTestClass]
    public class MathTest
    {
        [TestMethod]
        public void MaxTest()
        {
            Assert.AreEqual(64, Math.Max(16, 64));
            Assert.AreEqual(64, Math.Max(64, 16));
        }
    }
}

When you apply this attribute, all unit tests of the class will run in a separate AppDomain.

Last edited Oct 5, 2013 at 8:47 PM by GillesTourreau, version 5