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 and then or .
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.
Choosefrom the main menu.
Run the tests.