JetBrains Rider 2018.1 Help

Running and Debugging Unity Tests

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

  • Unity tests (including both edit-mode and play-mode 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. Play mode unit test classes can be added via the Solution Explorer: in the context menu, select Add | Play 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 debug on the toolbar.
    • Choose Run | Debug from the main menu.
    • Press F5.
  3. Run the tests.
Last modified: 20 August 2018