unity-test
Use when users want to run Unity tests or read test results.
Install
mkdir -p .claude/skills/unity-test && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/14373" && unzip -o skill.zip -d .claude/skills/unity-test && rm skill.zipInstalls to .claude/skills/unity-test
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Use when users want to run Unity tests or read test results.About this skill
Test Skills
Overview
Kick off Unity tests and read their XML reports. Recipes are stateless
fire-and-forget + read pairs — there is no job ID, no polling loop inside a
single Unity_RunCommand. Trigger a run in one call, read TestResults/*.xml
in a later call.
Mental model
- Trigger:
test_runortest_run_by_nameregisters a result callback, callsTestRunnerApi.Execute(...), and returns{ started: true, resultsPath }. - The run recipe's callback writes the XML —
TestRunnerApi.Executedoes not. When the run finishes, the registeredICallbacks.RunFinishedcallsTestRunnerApi.SaveResultToFile, producing<project-root>/TestResults/<mode>-mcp.xml. The api + callback are held in astaticso they survive the off-thread run. (No callback ⇒ no file: a bareExecutestarts the run but never writes a report.) - Read:
test_get_result,test_get_last_result, ortest_get_summaryparse the newest matchingTestResults/*.xmland return counts + failed names.
Polling across calls is the caller's job, not a recipe's. Only one Test Runner run should be active at a time.
Precondition: the Editor must be open and responsive on the intended project before triggering.
PlayMode caveat: a PlayMode run may trigger a domain reload that discards the in-memory callback before it fires, so no XML is written. For reliable PlayMode reports, disable domain reload for the run or use a persistent (compiled) editor runner. EditMode runs do not reload the domain.
Common Mistakes
DO NOT (common hallucinations):
test_run_alldoes not exist → usetest_runortest_run_by_name.test_create_templatedoes not exist → usetest_create_editmodeortest_create_playmode.test_get_statusdoes not exist → usetest_get_result(reads the XML, stateless).- There is no
jobIdanywhere. If older docs mention one, ignore them. - There is no
test_cancel— UnityTestRunnerApihas no public hard-cancel surface. - There is no
test_smoke_skills— it depended on an upstream REST skill registry that isn't in this pack.
Routing:
- For compile error checking →
editor_get_state(isCompilingfield). - For test script creation →
test_create_editmode/test_create_playmode, then edit via thescriptmodule.
Skills
test_run
Kick off tests. Returns { success, started, mode, filter, resultsPath }
immediately; the callback writes TestResults/<mode>-mcp.xml when the run ends.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| testMode | string | No | EditMode | EditMode or PlayMode. |
| filter | string | No | null | Test-name substring forwarded as Filter.testNames[0]. |
test_run_by_name
Kick off a single class or fully-qualified method. Returns
{ success, started, testName, mode, resultsPath }; the callback writes
TestResults/<mode>-mcp.xml when the run ends.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| testName | string | Yes | - | Exact class name or Ns.Class.Method. |
| testMode | string | No | EditMode | EditMode or PlayMode. |
test_get_result
Read the newest TestResults/<mode>-*.xml and return parsed counts.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| testMode | string | No | EditMode | Which XML family to filter on. |
Returns: { success, file, total, passed, failed, skipped, inconclusive, failedNames, startTime, endTime, durationSeconds }
test_get_last_result
Newest XML across all modes. No parameters.
Returns: { success, file, mode, total, passed, failed, skipped, inconclusive, failedNames, startTime, endTime, durationSeconds }
test_get_summary
Aggregate every XML report under TestResults/. No parameters.
Returns: { success, totalRuns, totalPassed, totalFailed, totalSkipped, totalInconclusive, allFailedTests, files }
test_list
List available tests.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| testMode | string | No | EditMode | EditMode or PlayMode. |
| limit | int | No | 100 | Max tests to list. |
test_list_categories
List test categories.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| testMode | string | No | EditMode | EditMode or PlayMode. |
test_create_editmode
Write an EditMode test template synchronously.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| testName | string | Yes | - | Class name. No /, \, ... |
| folder | string | No | Assets/Tests/Editor | Must start with Assets/ or Packages/. |
Returns: { success, path, testName }
test_create_playmode
Write a PlayMode test template synchronously.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| testName | string | Yes | - | Class name. No /, \, ... |
| folder | string | No | Assets/Tests/Runtime | Must start with Assets/ or Packages/. |
Returns: { success, path, testName }
RunCommand Examples
Recipe path rule: ../../recipes/test/<command>.md
See ../../recipes/test/<command>.md for C# templates.