Skip to main content
A newer version of this page is available. .

Running and Debugging Tests

  • 2 minutes to read

Use one of the following approaches to run tests:

  • From the Visual Studio Menu bar.

    Use the CodeRush | Test menu to run selected test(s) or all tests in the solution.

    CRR_Testing_RunFromMenu

  • From the CodeRush Visualize toolbar.

    Use the CodeRush Visualize toolbar's commands to run tests and debug them.

    CRR_VisualizeToolbar

  • From the Test Runner window.

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

    CRR_VisualizeToolbar

    The Test Runner displays all tests in the solution. You can group them, search for tests, filter tests by status, run tests, and analyze their results.

    CRR_Testing_TestRunner

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

    CRR_Testing_TestRunner

    NOTE

    The Run All command takes filtering into account. This command runs all tests shown in the tests tree when the Test Runner applied filtering.

  • From 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 tests:

    • Click the test-tube icon to open the drop-down test runner menu and click Run test.
    • Place the caret within a test and press Ctrl+T or Ctrl+R.

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

    RunSingleTestCase

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

  • From the Solution Explorer.

    Use the solution explorer's context menu to run tests in a document.

    CRR_Testing_RunFromSolutionExplorer

NOTE

You can run MS Test unit tests using Test Runner in Visual Studio 2019 RC

Debugging a Test

  • Place the caret within the test.

  • Press Ctrl + T, Ctrl + D (Test -> Debug)

CodeRush runs the test with the debugger. You can stop the test on break points and use watch windows. This allows you to setup a test for a particular situation and then observe exactly how your code behaves in that scenario.

Alternatively, you can click the Test icon to reveal the test context menu and choose Run test and Debug test from this menu.

RunSingleTestCase