JetBrains Rider 2024.1 Help


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

Test discovery

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

    This is the fastest way of discovering tests.

  • Test runner

    In this mode, JetBrains Rider 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, JetBrains Rider 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

JetBrains Rider installation includes 2 bundled test runners that support versions up to 2.7.1 and up to 3.15.5 correspondingly. Other versions up to 4.1.0 are supported and will be used if the corresponding NuGet package is installed in the project.

To use another NUnit version, tick this checkbox and enter the path to the local NUnit installation into the corresponding field.

NUnit 2

Load NUnit Addins

If you use NUnit addins for NUnit 2.x, you can choose Always or If required to discover addins in the following directories:

  • [test assembly's directory]

  • [test assembly's directory]/addins

  • [nunit installation directory]/addins

  • lib\ReSharperHost\TestRunner\Adapters\NUnit2\addins subfolder of the JetBrains Rider installation directory

NUnit 3

Prefilter types and methods when discovering tests in test runner

This checkbox enables the PreFilter feature of NUnit 3.x to load only the tests that are being executed instead of all tests in the test assembly. This option improves performance and should be enabled unless pre-filtering causes some issues.

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.

These pairs will work the same as TestRunParameters defined in the .runsettings file:

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