Unit Test Runner
- 4 minutes to read
The Unit Test Runner tool window lists unit tests contained in the current solution, facilitates their execution and navigation through tests, and processes test results.
The main part of the window is filled by the tests tree and the Details panel if it is not hidden. The tests tree lists all tests contained in the current solution.
The tree structure depends on the selected grouping type.
|Grouping type||Tree structure|
It allows you to execute tests contained in a selected test’s tree item or run each test separately. Each item of the tree is marked with a status icon. If a tests tree item contains several children with a different status, it will have the highest priority status of its children. For example, a class contains several tests. One of them is failed and the other tests are passed. The class will then have a “Failed” status, because its priority is higher than “Passed” priority.
|Test is failed||1|
|Test is passed||2|
|Test is ignored||3|
|Test has not been run||4|
The Details panel contains detailed information on the selected test or tests contained in the selected class, namespace or project.
You can navigate to a test directly from Details. Click the desired test reference to move the cursor to the appropriate test. If you click the file reference at the end of a call stack item, CodeRush Classic opens the appropriate file and moves the cursor to the expression that has caused the current test failure.
The Details panel context menu enables you to specify the way the panel displays information on tests.
It includes the following items.
Copies selection to clipboard.
Line view and Tree view
Specifies the way the CodeRush Classic displays call stack items on the panel.
Line view Tree view
Hide call stack items without file references
If this option is on, Unit Test Runner shows only call stack items that include file references.
Show passed items, Show ignored items, and Show failed items
Specifies whether passed, ignored, and failed tests are shown on the panel or not.
Enables you to increase or decrease the scale of the Details panel contents.
Console Output and Console Errors panels
The Console Output and Console Errors panels represent Console streams: output and error output.
The Console Output panel shows all messages passed to the Console.Write or Console.WriteLine methods called during a test execution.
The Console Errors panel shows all messages passed to the Console.Errors.Write or Console.Errors.WriteLine methods called during a test execution.
Unit Test Runner toolbar
The Unit Test Runner toolbar contains several buttons and the Filter text box. This text box enables you to filter the tests by entering a portion of the test method name.
The toolbar buttons are grouped into three sections.
Test execution control buttons
Executes tests and stops their execution.
|Executes the selected test(s) contained in the selected item.|
|Executes all tests shown in the tests tree. Tests that are filtered out are not executed if filtering is enabled.|
|Executes the selected test(s) contained in the selected item in debug mode.|
|Repeats the last test execution.|
|Refreshes the tests tree.|
Details position buttons
Specify the Details panel position.
|Hides the Details panel|
|Places the Details panel to the right of a tests tree.|
|Places the Details panel at the bottom of a tests tree.|
Tests filter buttons
Enable or disable tests filtering by status.
|Filters out all tests, except failed.|
|Filters out all tests, except ignored.|
The Grouping button opens the menu that enables you to specify tests grouping type. The button appearance depends on the currently selected value:
- - by project
- - by category
- - by namespace
- - flat
Unit Test Runner context menu
If you right click a tests tree item, the Unit Test Runner context menu will appear. This menu enables you to access the selected test code, and expand or collapse all nodes with a single click. It also contains the Run, Run All and Debug buttons, even those situated on the toolbar.
|Run||Executes the selected test(s) contained in the selected item.|
|Run All||Executes all tests shown in the tests tree. The filtered out tests are not executed, if filtering is enabled.|
|Debug||Executes the selected test(s) contained in the selected item in debug mode.|
|Go to Test||Opens the selected test code.|
|Expand All Children||Expands all tests tree nodes.|
|Collapse All Nodes||Collapses all tests tree nodes.|