The Unit Test project template is available with all versions of Visual Studio. However, with Visual Studio 2012 and 2013, the “Create Unit Test” functionality was removed due to complexities with MSTest and private accessors. Note that a free Visual Studio extension is available that will save some steps in creating unit tests. See https://visualstudiogallery.msdn.microsoft.com/45208924-e7b0-45df-8cff-165b505a38d7.
As shown above, by default, tests are listed by status – Not Run, Passed, Failed. However, there are other ways to categorize tests which can be seen by clicking the “Group by” option in the Test Explorer Window:
Using this option, tests can be organized by Class, by how long they run, by “Traits”, or by Project. The last two are particularly useful for large test projects that cover multiple projects and different types of tests.
In order to view the different types of tests, a test method can be tagged with one or more Test Categories as highlighted below:
Then, by selecting the “Traits” option for grouping, the tests can be viewed by category and also run by category:
The other benefit of test categories is the ability to specify the tests that should be used for automating the testing of the nightly build. By adding a “Build” category to a test, it can then be automatically included in a build action that includes this test project DLL. And there you have a great start to your nightly build test suite!