This post explains the features that have been introduced for unit testing in Visual Studio 2012 update 1 and 2. Visual Studio 2012 update 1 and 2 introduced many new features for testing which can be read here. New features grouping and filtering tests by project, by trait or by class enables testers to work with lots of tests easier.
Now developers can group their tests in test explorer according to which project they are in, what classes the test methods are in or by test trait. Test trait is a test property of a given unit test and several are available in MS test unit test framework. MS test finds the attributes used to mark test methods for specific traits. A test method can be attributed with an owner , priority or with test category.
[Test Class] public class TestClass1 { [Test Method] [Owner("James")] [Priority(0)] [TestCategory("Slow Running")] public void MsTestMethod1() { } }
Additionally developers can create their own traits using their test property attribute for MS Test
[Test] [Property("Test type", "ATDD")] public void NunitTest1() { }
Other unit testing frameworks may use other means of defining traits. example Nunit uses property attribute and Xunit uses trait attribute.
Filtering unit tests in test explorer allows developers to focus on just those that are important to them. This feature useful for solutions with hundreds of tests.
This helps running tests quick and easy. With Playlists developers can create custom lists mapping to exactly those test cases to run in specific situation.
Improvements are also been made to the Windows 8 store applications by simplifying complex testing scenarios. Windows 8 store applications use Async, Assert.ThrowsException of T enables the developers to test when an exception is thrown in Async lambda expressions.
[TestMethod] public void TestMethod1() { Assert.ThrowsException<NullReferenceException>( () => { throw new NullReferenceException(); }); }
Enable passing data in test methods, executing one pass throw the test method for every row of data.
Test methods can also be decorated with UITestMethod attribute forcing unit test to execute on Main UI thread.
More on this topic can be read here