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 .
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.
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
- Set breakpoints in Unity tests.
- Start debugging of the Attach to Unity Editor run configuration:
- Click on the toolbar.
- Choose from the main menu.
- Press F5.
- Run the tests.