ReSharper 2021.3 Help

xUnit.net

ReSharper options: Tools | Unit Testing | Test Frameworks | xUnit.net

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

Test discovery

To list xUnit.net 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 xUnit.net to define their parameters.

    This is the fastest way of discovering tests.

  • Test runner

    In this mode, ReSharper launches xUnit.net runner in the discovery mode on the build artifact, and then uses the results from the runner.

    Using xUnit.net 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 xUnit.net runner to execute all tests is the most accurate way of test discovery.

xUnit.net config file

ReSharper will try to find and load your xUnit.net configuration file in any of standard locations. If your configuration file is in a custom location, select Use specific configuration file and specify the path to this file. To learn about the format of the configuration files, see configuring xUnit.net with JSON and configuring xUnit.net with XML

Last modified: 07 April 2022