| name | unity-test-runner |
| description | Run and analyze Unity tests via Unity MCP. Use when running EditMode or PlayMode tests, creating test scripts, analyzing test failures, or when user asks to test code. |
| disable-model-invocation | true |
| allowed-tools | Read, Grep |
Unity Test Runner (via Unity MCP)
Running Tests
Via MCP (推奨)
Unity_RunCommand でテスト実行コードを記述:
internal class CommandScript : IRunCommand
{
public void Execute(ExecutionResult result)
{
var testRunner = UnityEditor.TestTools.TestRunner;
result.Log("Tests triggered");
}
}
Via Unity CLI (フォールバック)
"C:\Program Files\Unity\Hub\Editor\*\Editor\Unity.exe" ^
-batchmode -quit -projectPath . -runTests -testPlatform EditMode -testResults TestResults\results.xml
/Applications/Unity/Hub/Editor/*/Unity.app/Contents/MacOS/Unity \
-batchmode -quit -projectPath . -runTests -testPlatform EditMode \
-testResults TestResults/results.xml