Tuesday, August 6, 2013

Unit test generator extension - Visual studio 2012, 2013

The new unit test generator extension RC1 to visual studio was introduced by ALM Rangers that helps developers add "Create unit test" feature to visual studio. The new feature supports multiple framework targets, automated test project creation and configuration.

The feature comes with a configuration menu, which allows you mention the Test framework, naming conventions and options to construct the test method body on creation of unit tests.




You can now simply right click on a class with public methods and select Create unit tests to see the feature in action.


After test generation you can see the test class with the respective test methods added as given below.

using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace CQRS.LibTests
{
    [TestClass()]
    public class RespondToRsvpCommandValidatorTests
    {
        [TestMethod()]
        public void ValidateTest()
        {
            Assert.Fail();
        }
    }

}