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

Unit Testing Assistance

  • 2 minutes to read

You can use the CodeRush Unit Test Runner tool for the following tasks:

The Unit Test Runner consists of two parts:

  • a test runner tool window - allows you to run tests for all target frameworks in multi-framework projects. You can also debug tests and analyze their results.

    CRR_Testing_TestRunner

  • an in-editor UI - allows you to run tests from the code editor.

    RunSingleTestCase

You can configure the Unit Test Runner on the Test Runner and Test Runner Window options pages.

Running Tests in Multi-Framework Projects

If your test project contains multiple target frameworks, the CodeRush Test Runner allows you to run tests:

  • For all target frameworks

    CRR_Testing_TestRunner

  • For a selected framework

    CRR_Testing_TestRunner

You can also select an active target framework in the code editor.

CRR_Testing_TestRunner

Then, you can run tests for this selected framework.

CRR_Testing_TestRunner

If you use the "Run Tests" item in Solution Explorer's context menu, CodeRush runs tests for all target frameworks.

CRR_Testing_RunFromSolutionExplorer

Discovering Tests

If your solution contains tests and the appropriate framework is referenced, the Unit Test Runner:

  • Discovers tests from source code and assemblies when you open a solution. The "Collect tests from assemblies when projects build" option is initially enabled in the Test Runner options page.

  • Marks the tests with an icon to the left of each test attribute.

  • Creates a tests tree in the Test Runner tool window.

Test Framework Support

The Unit Test Runner supports the following testing frameworks:

Refer to the Testing Framework Configuration article for details on how to set up the testing framework.

NOTE

CodeRush Test Runner supports running tests under SciTech Software’s .NET Memory Profiler. This third-party product allows you to use the Run Under Memory Profiler toolbar button (Icon_MemProfiler) to run tests designed to identify memory leaks and other memory usage issues.