Working with Test Sessions

  • 2 minutes to read

The Unit Test Runner supports sessions. This allows you to create several test sets and run them independently. There are two ways to create a session:

Create a New Session

From the Code Editor

Click the icon that supplements the Test or TestFixture attribute and select the Add to session | Create a new session menu item.

Testing_NewSessionEditor

From the Test Runner Window

Right-click a node in the Test Runner window and select the Add to session | Create a new session menu item.

Testing_SesstionFromWindow

The Test Runner creates a new session and adds your chosen tests to a new tab with the name "Session 1".

The Test Runner can create multiple test sessions. You can work with each session independently, and select the corresponding tab to switch between sessions.

Rename a Session

To rename a session, double-click the tab text and edit it.

Testing_SessionRename

Add More Tests to a Session

Perform one of the following actions:

  • Invoke the Test or Test Fixture context menu in the code editor and select the Add to Session | Add to (your session name) menu item.

    Testing_SessionRename

  • Right-click a node in the Test Runner window and select the Add to Session | Add to (your session name) menu item.

    Testing_SessionRename

NOTE

The sessions persist after the Visual Studio restart. CodeRush saves sessions to the ".cr\personal\Unit Testing\Sessions.xml" file. The ".cr" folder contains solution specific settings. The ".cr" folder is created in the same folder as the ".sln" file.