You can also use Test Explorer to group tests into categories, filter the test list, and create, save, and run playlists of tests. You can debug tests and analyze test performance and code coverage. Visual Studio includes the Microsoft unit testing frameworks for both managed and native code. However, Test Explorer can also run any unit test framework that has implemented a Test Explorer adapter. For more information about installing third-party unit test frameworks, see Test Explorer can run tests from multiple test projects in a solution and from test classes that are part of the production code projects. Test projects can use different unit test frameworks. When the code under test is written for the. NET Framework, the test project can be written in any language that also targets the. NET Framework, regardless of the language of the target code. For more information, see. Run tests in Test Explorer When you build the test project, the tests appear in Test Explorer. If Test Explorer is not visible, choose Test on the Visual Studio menu, choose Windows, and then choose Test Explorer. As you run, write, and rerun your tests, Test Explorer displays the results in default groups of Failed Tests, Passed Tests, Skipped Tests and Not Run Tests. You can change the way Test Explorer groups your tests. You can perform much of the work of finding, organizing and running tests from the Test Explorer toolbar. Run tests You can run all the tests in the solution, all the tests in a group, or a set of tests that you select. This can noticeably reduce the time taken to run all the tests. Run tests after every build Button Description To run your unit tests after each local build, choose Test on the standard menu, and then choose Run Tests After Build on the Test Explorer toolbar. View test results As you run, write, and rerun your tests, Test Explorer displays the results in groups of Failed Tests, Passed Tests, Skipped Tests and Not Run Tests. The details pane at the bottom of Test Explorer displays a summary of the test run. View test details To view the details of an individual test, select the test. View the source code of a test method To display the source code for a test method in the Visual Studio editor, select the test and then choose Open Test on the context menu Keyboard: F12. Group and filter the test list Test Explorer lets you group your tests into predefined categories. You can also filter the list of tests by matching strings against test properties. Group tests in the test list To change the way that tests are organized, choose the down arrow next to the Group By button and select a new grouping criteria. Test Explorer groups Group Description Duration Groups test by execution time: Fast, Medium, and Slow. Outcome Groups tests by execution results: Failed Tests, Skipped Tests, Passed Tests. The syntax to specify trait categories and values is defined by the unit test framework. Project Groups test by the name of the projects. Traits can be assigned to methods that are identified as a test method by the unit test framework. A unit test framework can define trait categories. The syntax to specify trait categories and values is defined by the unit test framework. The test framework also contains these predefined traits: Trait Description The Owner category is defined by the unit test framework and requires you to provide a string value of the owner. The Priority category is defined by the unit test framework and requires you to provide an integer value of the priority. The TestCategory attribute enables you to provide a category without a value. A category defined by the TestCategory attribute can also be the category of a TestProperty attribute. Traits in the Microsoft Unit Testing Framework for C++ See. Search and filter the test list You can use Test Explorer filters to limit the test methods in your projects that you view and run. When you type a string in the Test Explorer search box and choose Enter, the test list is filtered to display only those tests whose fully qualified names contain the string. Note Searches are case insensitive and match the specified string to any part of the criteria value. Qualifier Description Trait Searches both trait category and value for matches. The syntax to specify trait categories and values are defined by the unit test framework. Project Searches the test project names for matches. Error Message Searches the user-defined error messages returned by failed asserts for matches. File Path Searches the fully qualified file name of test source files for matches. Fully Qualified Name Searches the fully qualified file name of test namespaces, classes, and methods for matches. Output Searches the user-defined error messages that are written to standard output stdout or standard error stderr. The syntax to specify output messages are defined by the unit test framework. Outcome Searches the Test Explorer category names for matches: Failed Tests, Skipped Tests, Passed Tests. Create custom playlists You can create and save a list of tests that you want to run or view as a group. When you select a playlist, the tests in the list are displayed in Test Explorer. You can add a test to more than one playlist, and all tests in your project are available when you choose the default All Tests playlist. To create a playlist, choose one or more tests in Test Explorer. Save the file with the name and location that you specify in the Create New Playlist dialog box. To add tests to a playlist, choose one or more tests in Test Explorer. On the context menu, choose Add to Playlist, and then choose the playlist that you want to add the tests to. If individual tests have no dependencies that prevent them from being run in any order, turn on parallel test execution with the toggle button on the toolbar. This can noticeably reduce the time taken to run all the tests. Debug and analyze unit tests Debug unit tests You can use Test Explorer to start a debugging session for your tests. Stepping through your code with the Visual Studio debugger seamlessly takes you back and forth between the unit tests and the project under test. Note Because test methods can run in any order, set breakpoints in all the test methods that you want to debug. For more information, about the debugger, see. Diagnose test method performance issues To diagnose why a test method is taking too much time, select the method in Test Explorer and then choose Profile on the context menu. Analyze unit test code coverage You can determine the amount of your product code that is actually being tested by your unit tests by using the Visual Studio code coverage tool. You can run code coverage on selected tests or on all tests in a solution. The Code Coverage Results window displays the percentage of the blocks of product code that were exercised by line, function, class, namespace and module. For more information, see. Test shortcuts Tests can be run from the Test Explorer, by right-clicking in the code editor on a test and selecting Run test, or by using the default in Visual Studio. Some of the shortcuts are context-based. This means that they run or debug tests based on where your cursor is in the code editor. If your cursor is inside a test method, then that test method runs. If your cursor is at the class level, then all the tests in that class run. This is the same for the namespace level as well. Frequent Commands Keyboard Shortcuts TestExplorer. DebugAllTestsInContext Ctrl+ R, Ctrl+ T TestExplorer. RunAllTestsInContext Ctrl+ R, T.