JetBrains Rider 2021.2 Help

MSTest

On this page of JetBrains Rider options, you can adjust unit testing settings related to MSTest tests.

Test discovery

To list MSTest tests from your solution in the Unit Tests window, JetBrains Rider needs to discover unit tests.

The discovery of tests in specific project happens only after the project is built. You can choose between two options that allow you to prefer either speed or accuracy for discovering unit tests after the build.

  • Metadata (default)

    In this mode, JetBrains Rider analyzes the build artifact without launching the test runner.

    As tests are defined using attributes, JetBrains Rider can quickly scan the metadata of managed artifacts to find most tests in the project. However, it may fail to find tests that require running some special hooks of MSTest to define their parameters.

    This is the fastest way of discovering tests.

  • Test runner

    In this mode, JetBrains Rider launches MSTest runner in the discovery mode on the build artifact, and then uses the results from the runner.

    Using MSTest runner can take considerably longer to analyze the project, but the list of discovered tests will be complete in most cases.

After you run all tests from a specific project, JetBrains Rider will update the list of tests in this project independently of the selected discovery mode because letting the MSTest runner to execute all tests is the most accurate way of test discovery.

Test Settings

Specify a custom test settings configuration (.runsettings/ .runconfig/ .testsettings file within your solution).

MSTest and Visual Studio Integration

As MSTest v1 is not distributed without Visual Studio, you have to specify the IDE folder inside a Visual Studio installation on your machine. JetBrains Rider will find all necessary executables in this folder.

MSTest v2, on the other hand is delivered as a NuGet package. If you are using MSTest v2 in a .NET Core project, then you do not need to specify the IDE folder.

Last modified: 30 September 2021