[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Collapse]CodeRush
  System Requirements
  Improve Performance
 [Expand]Features by Language
 [Expand]Getting Started
 [Expand]How To
 [Expand]Coding Assistance
 [Expand]Navigation and Search Tools
 [Expand]Static Code Analysis
 [Expand]Visualization Tools
 [Expand]Code Style Assistance
  Building Assistance
  Debugging Assistance
 [Expand]Refactoring Assistance
 [Collapse]Unit Testing Assistance
   Testing Framework Configuration
   Running and Debugging Tests
   Test Execution Output
   Working with Test Sessions
   Code Coverage Calculation
   JavaScript Test Runner
   Unit Test Builder
 [Expand]Decompiling Tools
 [Expand]Configuration Options
 [Expand]Extensibility
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Testing Framework Configuration

CodeRush is shipped with the necessary assemblies required to run unit tests. However, if you are using a specific framework version, you may need to run tests using your library. If you already have a testing framework in your project, refer to the Use Integrated Framework section. Otherwise, follow the instructions in the Install a Testing Framework section.

Expanded Install a Testing Framework

Follow the steps below to download and reference the necessary testing framework using the NuGet Package Manager Console.

  1. Open the NuGet Package Manager Console using the Tools | NuGet Package Manager | Package Manager Console Visual Studio menu item.
  2. Choose the project you are going to test in the "Default project" drop-down menu.
  3. Enter one of the following commands depending on the testing framework you are going to use:

    • NUnit 3.0

      Install-Package NUnit

    • xUnit

      Install-Package xunit

    • MSpec

      Install-Package Machine.Specifications

  4. Press the Enter key and wait until all the required packages are downloaded and added to the project.
  5. Check to ensure that the NuGet package manager output does not contain errors.

After referencing a testing framework, you can start creating unit tests.

When the solution contains one or more unit tests, you can run them using the Unit Test Runner. Refer to the Running and Debugging Tests article to learn more about the test runner.

Expanded Use Integrated Framework

CodeRush is shipped with several versions of the most common testing frameworks:

  • NUnit

    • 2.4
    • 2.5
    • 2.5.9
    • 3.0
    • 3.4
  • xUnit

    • 1.9
    • 2.0
    • 2.1

If you use one of these versions in your project, you can run unit tests using CodeRush without any additional configuration. Otherwise, refer to the Reuse Existing Framework section.

Unit Test Runner also supports .NET Core test cases and Microsoft Fakes isolation framework.

Expanded Reuse Existing Framework

This section describes how to configure the Unit Test Runner to run tests using the unit testing framework library that you already have.

The paths to libraries used for running tests are configured in the Unit Testing | Test Runner options page. At the Supported frameworks section, choose the required framework to see what libraries are used for running tests. Use the ellipsis button at the right of a path to a library to change the library reference.

Is this topic helpful?​​​​​​​