resharper-unity icon indicating copy to clipboard operation
resharper-unity copied to clipboard

Slow unit tests

Open bartlomiej-dawidow opened this issue 1 year ago • 4 comments

When we run our unit tests from within Rider, they take a very long time to complete. It appears that the individual tests are fast but there are long pauses between them, in the order of tens of seconds.

When we start the same set of unit tests from within the Unity editor, they finish nearly instantly.

When we run tests in our non-Unity projects from within Rider, they also run normally.

So the problem appears to be in how resharper-unity launches the tests.

bartlomiej-dawidow avatar Feb 27 '25 15:02 bartlomiej-dawidow

Our project consists of a large number of relatively small .asmdefs, and so our unit tests are also spread out across a number of assemblies. It looks like the pauses are not between individual test methods or classes, but between assemblies.

bartlomiej-dawidow avatar Feb 27 '25 15:02 bartlomiej-dawidow

Hi! I think this was fixed on the Unity side at some point https://youtrack.jetbrains.com/issue/RIDER-93012/Unity-Unit-Tests-5-7-times-slower-in-Rider-vs-TestRunner-in-Unity-Editor There were also a workaround in the thread for older Unity versions. Please let me know if it helps.

van800 avatar Feb 27 '25 16:02 van800

I tried changing "Interaction mode" in Unity settings to "No Throttling" but it didn't make any noticeable difference. Neither did keeping Unity editor in the foreground and focused. The tests still run tens or hundreds of times slower than when using the Unity test runner.

Our setup: Unity 6000.0.36f1 Test Framework 1.4.5 Rider 2024.3.5

bartlomiej-dawidow avatar Feb 27 '25 21:02 bartlomiej-dawidow

To keep this report in the loop, would you mind creating a ticket in Rider with Help - Report a bug, agree to attach logs. Please run those tests before reporting, to simplify finding this place in the logs.

van800 avatar Feb 28 '25 05:02 van800