Running and Debugging Unit Tests

ReSharper recognizes unit tests that conform to one of the supported frameworks and lets you run and debug them right in Visual Studio. You can run or debug:

You can start running or debugging unit tests in several different ways.

To run or debug all unit tests in a solution or project:

Right-click a project node or a solution node in Solution Explorer and select Run Unit Tests or Debug Unit Tests .

The Unit Test Runner Window is opened when you start running tests. The window can also be opened from ReSharper menu by selecting Window | Unit Test Runner.

 

To run or debug individual unit tests or unit test classes:

Do one of the following

The Unit Test Runner Window is opened when you start running tests. The window can also be opened from ReSharper menu by selecting Window | Unit Test Runner.

When you right-click in the editor, the context menu appears from which you can run and debug tests. Right-click inside a test method to run or debug that single test. Right-click outside of any test method to run or debug the entire test class contained in the current file.

When you use the ReSharper menu, the caret position will determine which test or tests will be run or debugged. If the caret is inside a test method, that single test will be run or debugged. If it is outside any test method, the entire test class contained in the current file will be run or debugged.

Sidebar Marks

To the left of the test class declaration ReSharper places this mark:

You can click the sidebar mark to proceed with running or debugging all tests in that test class:

Individual tests also have their sidebar marks which look like this:

The individual test mark lets you run and debug  a single test independently of other tests in the same class.

See Also

Unit Test Runner Window | Profiling Unit Tests with dotTrace Profiler