Unit Test Runner Window

Unit test running is performed in Unit Test Runner window. The window appears automatically when you run tests from the code editor or from Solution Explorer. You can also open the window by selecting ReSharper | Window | Unit Test Runner.

Unit Test Tree view

The Test Tree View is populated with all tests contained in the assembly (or assemblies) being tested. Each tree node is marked with an icon showing its state (see the Node Icons table for details).

In addition to viewing the structure of the tree, from this view you can navigate to the source code of a test or test class, or start running, debugging or profiling tests. You can do the following with a test or test class node:

The same commands are also available via the toolbar buttons located above the tree view (see Toolbar).

Tree view tabs

The Test Tree View has two additional tabs for displaying failed tests and ignored tests. The number in parentheses shows the number of tests contained in the corresponding tab.

The Failed tab is a rendering of the same test tree filtered to show only the failed tests.

The Ignored tab filters the test tree to show all tests that were ignored, i.e. those that had an ignore attribute (depending on the unit test framework). Ignored tests are normally skipped when running tests. However, an ignored test or test class can still be run individually from Unit Test Runner window or from the code editor.

Node Icons

The colored icons at each tree node represent the test run state:

Icon Description For individual test nodes For nodes other than tests
green The test passed successfully All tests inside this node passed successfully
red The test failed At least one of the tests inside this node failed
yellow The test was ignored All tests were ignored inside this node
red, crossed Test run was aborted Test execution was aborted somewhere inside this node
grey The test has not run No tests were run inside this node
green, with question mark The test passed successfully the last time it ran, but the code has been modified and recompiled since then At least one test inside this node failed the last time it ran, but the code has been modified and recompiled since then
red, with question mark The test failed the last time it ran, but the code has been modified and recompiled since then All tests inside this node passed successfully during the last time it ran, but the code has been modified and recompiled since then

Toolbar

Toolbar buttons are explained in the following table:

 

Button Name Action
Navigate to Source Navigates to the source code for the selected test or test class
Build Projects

Re-builds all tests currently loaded into Unit Test Runner

Note: Once an assembly is loaded into Unit Test Runner, any changes introduced in the code since the last compilation will NOT take effect when running or debugging tests from Unit Test Runner window. Use Build Projects to take any changes into account and update the build. Alternatively, you can run or debug tests from the code editor or from Solution Explorer.

Run All Tests No tests were run inside this node
Run Selected Test Runs the selected test or all tests of the selected assembly, namespace or test class
Debug Selected Test Debugs the selected test or all tests of the selected assembly, namespace or test class
Profile Selected Test

Opens an instance of dotTrace Profiler and automatically profiles the selected

Note: A current version of dotTrace Profiler must be installed on your system.

Stop Execution Aborts any ongoing test execution
Track Running Test Is used to track the currently running test by highlighting its node in the tree view
Hierarchical View Toggles the tree viewing mode: shows the hierarchy of assemblies, namespaces and test classes
Plain View Toggles the tree viewing mode: shows only the test classes with their respective tests
View by Category Toggles the tree viewing mode: shows all test classes with their respectives tests by category (a test may appear several times in the tree, once for each category)

 

 

Progress Bar and Diagnostics

The progress bar shows the progress of the current test run.

In addition, its color reveals the overall status of the run:

The diagnostics message below the progress bar offers a short summary of the test run. If the run is in progress, it refers to the test running currently. If the run has stopped, it refers to the test currently selected in the tree view.

The diagnostics message will usually be "Success", "Some tests failed", "Execution aborted" or "Ignored". However, if the current node is a failed test, the diagnostics message will provide the type of the exception that occurred:

Output and Statistics Views

The Output View displays console output and exception stack traces produced during the test execution for the test currently selected or currently running. If the current tree node is not a leaf node, output is aggregate for all of the node's children.

Sample output is given below:

The message indicates the discrepancy between target output and actual output. It also provides a link to the code statement where the error occurred. You can click the link to navigate to the corresponding line in the source code.

The Click to View Difference button displays a window showing the exact difference in the target output and the actual output such as shown below:

Statistics View

The statistics view lists time measurements for the currently selected test or for all its children. Duration of test runs may vary depending on CPU usage at run time.

See Also

Running and Debugging Unit Tests | Profiling Unit Tests with dotTrace Profiler