run-tests
Installation
SKILL.md
Guide for running Unity tests with the run_unity_tests tool, running Play Mode tests on a standalone player, and verifying [Category("VisualVerification")] tests from their screenshots.
Gotchas
- Never call two Unity Editor tools in parallel.
unity_play_control,get_unity_compilation_result,run_unity_tests, andrun_method_in_unitymust be called strictly one at a time — always wait for each call to return before making the next one. Calling them concurrently causes domain-reload conflicts that result in "canceled" or "did not connect within 30 seconds" errors. - When a Unity Editor tool returns
errororcanceled, wait 10 seconds before retrying. Domain reload typically takes several seconds; immediate retry hits the same in-flight reload and fails again. Do not switch tools in the meantime (e.g., callingunity_play_controlto verify state) — that just compounds the multiplexed calls. If the same tool returnserrororcanceledon two consecutive attempts (with the 10-second wait between them), stop and consult the user instead of retrying further. - After adding or deleting assets that a
[TestCaseSource]or[ValueSource]enumerates, request a domain reload before running the tests. The Editor builds the test tree once per domain and reuses it, and an asset import (AssetDatabase.Refresh) does not reload the domain, so the test cases stay as they were at the last reload — a source that found no assets then keeps failing withNo arguments were provided. Callrun_method_in_unitywithassemblyName: UnityEditor.CoreModule,typeName: UnityEditor.EditorUtility,methodName: RequestScriptReload, then run the tests.
Run Tests
Before running tests, complete the following steps in order: