In the previous post you have learned how to get started with Unit Test in Visual Studio (How to write your very first Unit Test in Visual Studio using MSTest Framework easily ?) . Now it’s the time to manage the explore your Unit Tests in Visual Studio. The objective of the Test Explorer is to quickly access to test methods and execute then efficiently and as and when they are required. Once solution is build, all the test methods discovered automatically by the Visual Studio and listed in Test Explorer in “Not Run Tests” status. Then onwards, based of the execution status of the test method, the indication / status of methods change.
To open the Test Explorer , Navigate to Test –> Windows –> Test Explorer from the main menu.
If your solution has not build yet and you open the Test Explorer, it will display a message as below to ask build the solution so the Visual Studio can discover the test methods. Then only you would be able to execute them.
Once you build the solution, Test Explorer will list out all the test methods with “Not Run Tests” group.
From here you can “Run All” or Run specific test method / run selected test methods.
Once the execution is completed, all the test method status ( Passed, Failed, Skipped etc.) would be updated in the list and you can group them to view in different category.
By selecting the failed test cased, the test explorer can also display the error/ failed reasons of the test cases.
The Test Explorer also gives the provision of Run specific test cases like Failed Test, Not Run Test Cases etc. You can explore this list of options, they are very straight forward and easy to run.
Test explorer also support search specific test method – with in class, files , etc. and group by based on duration, outcomes, project etc. The image below shows the same.
Hope this help.