Unit Test Runner

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.

trUnitTestRunnerToolWindow

Tests tree

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.

trGroupingItems

Grouping type Tree structure
trIconByProject By project trStructureByProject
trIconByCategory By category trStructureByCategory
trIconByNamespace By namespace trStructureByNamespace
trIconFlat Flat trStructureFlat

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.

Status Icon Description Priority
trTestFailed Test is failed 1
trTestPassed Test is passed 2
trTestIgnored Test is ignored 3
trTestReadyToRun Test has not been run 4

Details Panel

The Details panel contains detailed information on the selected test or tests contained in the selected class, namespace or project.

trDetailsPanel

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.

trDetailsPanelMenu

It includes the following items.

  • Copy

    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
    trCallStackLineView trCallStackTreeView
  • 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.

  • Zoom

    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.

    trConsoleOutputPanel

  • The Console Errors panel shows all messages passed to the Console.Errors.Write or Console.Errors.WriteLine methods called during a test execution.

    trConsoleErrorsPanel

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.

trFilteringTestsByName

The toolbar buttons are grouped into three sections.

Test execution control buttons

Executes tests and stops their execution.

Button Description
trbRun Executes the selected test(s) contained in the selected item.
trbRunAll Executes all tests shown in the tests tree. Tests that are filtered out are not executed if filtering is enabled.
trbDebug Executes the selected test(s) contained in the selected item in debug mode.
trbRepeatLastTest Repeats the last test execution.
trbStopTesting Stops testing.
trbRefreshTree Refreshes the tests tree.

Details position buttons

Specify the Details panel position.

Button Description
trbDetailsOff Hides the Details panel
trbDetailsRight Places the Details panel to the right of a tests tree.
trbDetailsBottom Places the Details panel at the bottom of a tests tree.

Tests filter buttons

Enable or disable tests filtering by status.

Button Description
trbFilterFailed Filters out all tests, except failed.
trbFilterIgnored Filters out all tests, except ignored.

Tests grouping

The Grouping button opens the menu that enables you to specify tests grouping type. The button appearance depends on the currently selected value:

  • trIconByProject - by project
  • trIconByCategory - by category
  • trIconByNamespace - by namespace
  • trIconFlat - 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.

trContextMenu

Item Description
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.