ReSharper 2020.3 Help

NUnit

ReSharper | Options | Tools | Unit Testing | Test Frameworks | NUnit

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

Test Discovery

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

    This is the fastest way of discovering tests.

  • Test runner

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

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

Custom NUnit installation

Use specified custom NUnit

If you want to use another NUnit version, tick this checkbox and enter the path to the local NUnit installation into the corresponding field

Notes:

  • ReSharper 2020.3 supports NUnit 3.10.1 and later.

  • If there are any NUnit addins in this custom installation, they will be loaded too.

NUnit 2

Load NUnit Addins

If support of NUnit 2x is selected above and you need to use NUnit addins for this bundled version, put the addins in the NUnit2\addins subfolder of the ReSharper installation directory (which is shown for your convenience) and choose how to load them.

NUnit 3 Test Parameters

Use this list to add {name, value} pairs, which will be available in your NUnit tests via NUnit.Framework.TestContext.Parameters at runtime.

If you have specified a .runsettings file in Visual Studio, these pairs will be combined to TestRunParameters defined in the currently selected .runsettings file. In case of conflicting parameters, values specified in ReSharper settings will have priority.


<?xml version="1.0" encoding="utf-8" ?> <RunSettings> <TestRunParameters> <Parameter name ="param1" value="value1" /> </TestRunParameters> </RunSettings>
Last modified: 24 February 2021