JetBrains Rider 2018.3 Help

Running and Debugging Unity Tests

Rider provides the support for Unity tests via its Unit Tests window:

  • Unity tests are discovered from code and from the Unity editor and are automatically added to the Explorer tab of the Unit Tests window.

  • All Rider unit test features are available for Unity tests too including grouping, filtering based on test status, and other. Test output is parsed to make stack traces, class and method names into hyperlinks.

  • You can add new Unity tests either in the Unity editor or in Rider. Unit test classes can be added via the Solution Explorer: in the context menu, select Add and then Play Mode Test or Edit Mode Test.

You can run Unity tests as you run regular unit tests. Note that all tests in a Unity solution are run using the Unity test runner. Rider just sends requests to the Unity editor and listens for test results.

unity test gutter
Note that though the Debug action is present in the test's context menu, it's not yet supported. If you select Debug, it will simply run the tests. Nevertheless, a simple workaround is available.

To debug Unity tests

  1. Set breakpoints in Unity tests.

  2. Start debugging of the Attach to Unity Editor run configuration:

    • Click icons actions startDebugger svg on the toolbar.

    • Choose Run | Debug from the main menu.

    • Press Alt+F5.

  3. Run the tests.

Last modified: 18 February 2019