Unit Test Runner is a powerful unit testing tool. It executes your unit tests, navigates through tests, and facilitates the processing of test results. Unit Test Runner supports the MbUnit, MSpec, VS Test, NUnit, SlUnitTesting and xUnit frameworks.
If your solution contains tests and the appropriate framework is referenced, then Unit Test Runner recognizes the tests, marks them with an icon to the left of each test attribute, and creates a tests tree in the Unit Test Runner tool window, which enables you to easily navigate through tests.
Unit Test Runner requires the path to the current test provider executable to be specified in the Test Runner options page.
Once the tests have been parsed, you can execute them. Use one of the following execution methods.
The first two execution methods enable you to run tests in debug mode.
Choose an item (or several items) from the Tests tree and click the Run Selected Tests button, or simply double click the item. This will execute the item if it is a test, or it will execute all child tests if the item is a solution, a namespace, or a class. To execute all tests, click Run All. Click the Debug button to run the test in a debug mode. To repeat the last test execution, click Repeat last test(s).
Run All executes all tests shown in the tests tree, taking filtering into account. For example, if you click Run All when all tests except failed tests are filtered out, only the failed tests will be executed.
From the Code Editor
To execute a certain test, click its icon in the code and choose Run Test (or Debug to run in debug mode) from the context menu. You can also right-click anywhere within a test or a class, and choose Run test(s) from the context menu to execute the test or all tests in the class.
You can also use shortcuts to execute tests from code. The shortcuts are specified via the Shortcuts options page.
From the Solution Explorer
Right-click a solution explorer item containing tests and choose Run Test(s) from the context menu. It will execute all tests contained in the item.
Use the CodeRush.UnitTests.Execute() method located in the DevExpress.CodeRush.Core namespace. CodeRush.UnitTests includes several overloads of the Execute method, which enable you to run separate tests or test collections. To execute tests in debug mode, use the CodeRush.UnitTests.Debug() method and its overloads.
public void ExecuteTests()
if (CodeRush.UnitTests.Tests != null)
Public Class RunTests
Public Sub ExecuteTests()
If Not (CodeRush.UnitTests.Tests Is Nothing) Then
The status of all tests (passed, failed, ignored, etc.) is indicated within the code editor with an icon to the left of the test attribute, as well as in the Unit Test Runner window. This window also includes information on test execution duration to the right of the tests tree.
A test can have the following status.
Test has not been run
Test has passed
Test has failed
Test was ignored
To obtain more information on a failed test, simply place the mouse pointer over the appropriate icon in the source code. You can right-click a test listed in the Unit Test Runner and select Go to Test to navigate to that test.
Detailed test execution results are displayed in the Visual Studio Output window. The code line that caused the test failure is highlighted.
To simplify the processing of test results, the Unit Test Runner tool window provides test grouping, as well as the easy-to-use test filtering capability.
You can group tests by project, category or namespace, or show all tests in a single list. Choose the appropriate item from the Grouping menu.
To show only failed or ignored tests, click the corresponding button in the Unit Test Runner toolbar.
You can also filter the tests listed by entering a portion of the test's method name.
Test filtering affects the Run All feature's operation. If you click Run All in the Unit Test Runner window, tests that have been filtered out will not be executed.
This product is designed for outdated versions of Visual Studio. Although Visual Studio 2015 is supported, consider using the CodeRush extension with Visual Studio 2015 or higher.
Was this page helpful?
Thanks for your feedback! Any other suggestions? Tell us here.