Skip to main content

Run and Debug Tests

  • 2 minutes to read

Use one of the following approaches to run or debug unit tests:

Visual Studio Menu Bar

Open the CodeRush | Test menu and choose the corresponding menu item.

CRR_Testing_RunFromMenu

Note

You can restore the default CodeRush menu position in Visual Studio 2019 16.4 or later (the CodeRush menu is nested inside Visual Studio’s Extensions menu). Start Visual Studio, select Extensions -> Customize Menu…, uncheck the CodeRush item in Extensions Menu tab, and restart Visual Studio.
NestOption

The CodeRush Visualize Toolbar

Use the CodeRush Visualize toolbar’s commands.

CRR_VisualizeToolbar

The Test Runner Window

Click the CodeRush | Windows | Test Runner menu item to open the Test Runner Window.

CRR_VisualizeToolbar

If the Unit Test Runner is disabled, click the Enable link to activate it.

CRR_Testing_TestRunner

If your project contains multiple frameworks, you can run tests or debug them for all target frameworks, or a selected framework in the Test Runner window.

CRR_Testing_TestRunner

You can use the Unit Test Runner to run/debug MS Test unit tests in Visual Studio 2019 RC and for Universal Windows Platform (UWP) applications. The screenshot below shows the Test Runner in UWP application:

CRR_Testing_TestRunner

The Code Editor

If a test is parsed and ready to run, CodeRush marks the Test and TestFixture attributes with the test-tube icon.

CRR_CodeEditor_Test

Use one of the following ways to run or debug tests:

Option 1

Select an active target framework (for multi-framework projects).

CRR_Testing_TestRunner

Click the test-tube icon to open the drop-down test runner menu and click Run test or Debug test menu item.

CRR_Testing_TestRunner

Option 2

Place the caret inside a test method and press Ctrl+T,R or Ctrl+T,D.

To run a single test case of a parameterized test, click a test icon and choose an option from the Run test, Run test with coverage, or Debug test sub menu. CodeRush shows failed tests at the top of the sub menu.

RunSingleTestCase

You can also use the same approach to run/debug a test for a particular descendant of the current class.

The Solution Explorer

Use the solution explorer’s context menu to run/debug tests in a document.

CRR_Testing_RunFromSolutionExplorer

CodeRush runs/debugs tests for all target frameworks in multi-framework projects.