ReSharper 2021.3 Help

MSTest

ReSharper options: Tools | Unit Testing | Test Frameworks | MSTest

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

Test discovery

To list MSTest tests from your solution in the Unit Test Explorer window, ReSharper 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, ReSharper analyzes the build artifact without launching the test runner.

    As tests are defined using attributes, ReSharper 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, ReSharper 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, ReSharper 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

Choose where ReSharper should look for test settings:

Use .runsettings/.runconfig/.testsettings specified in Visual Studio. If this option is enabled, ReSharper will reuse test settings from Visual Studio when possible.

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

The Edit... button, which is active when a non-default settings configuration is selected, opens the Visual Studio's Test Settings dialog where you can adjust the selected configuration.

Last modified: 07 April 2022