JetBrains Rider 2024.2 Help

Test categories

NUnit, MSTest, and xUnit frameworks allow grouping tests and test classes into suites with the Category (NUnit) or TestCategory (MSTest) attribute on the corresponding symbols. xUnit provides the Trait attribute with the similar functionality. JetBrains Rider is aware of these attributes and provides a number of related features.

Browse Test Categories

In the Unit Tests window, you can explore all existing categories in the current solution. To do so, in the Group by selector, choose Categories or Project and Categories.

Completion for category names

When you type the name of a category, JetBrains Rider displays all existing and recently used categories, as well as ignored categories in the completion list:

JetBrains Rider: Code completion for unit test categories

Execute all tests in a category

From each test/test class belonging to some category, you can start execution of all tests in this category. To do so, press Alt+Enter or click the action indicator, choose Run/Debug or Run All/Debug All, Profile/Profile ALl or Cover/Cover ALl in the action list, and then click the small arrow on the right and click the category name or press Enter:

JetBrains Rider: Executing unit tests in a category

Another option to run all tests in a category is to group tests by category in the Unit Tests window, choose the category node, and then click Run Unit Tests Run Unit Tests Ctrl+;, R/ Debug Unit Tests Debug Unit Tests Ctrl+;, D or Cover Unit Tests Cover Unit Tests on the toolbar.

Ignore categories

If necessary, you can add one or more categories to the ignore list. All tests belonging to these categories will be skipped during the execution of a unit test session. Note that you can still run specific tests from ignored categories individually.

To add a category to the ignore list, type the category name into the Skip tests from categories field on the Build, Execution, Deployment | Unit Testing page of JetBrains Rider settings Ctrl+Alt+S. If you enter multiple categories, use comma as the delimiter.

For XUnit tests, where there is no special attribute for categories, list the ignored categories as follows:

  • For attributes like [Trait("One", "Two")], add One [Two] in the settings field.

  • If the first argument of the attribute is Category, for example [Trait("Category", "Three")], then you can add it as Three in the settings field.

Last modified: 25 September 2024