一键导入
unity-test
Use when users want to run Unity tests or read test results.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when users want to run Unity tests or read test results.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use when working with a Unity project via MCP — creating or editing scenes, GameObjects, components, prefabs, materials, UI, lighting, navmesh, animations, terrain, C# scripts, or any other Unity Editor task.
Use when users want to enter play mode, select objects, undo/redo, or execute menu commands.
Use when creating, reading, editing, searching, validating, or deleting C# scripts in a Unity project.
Use when about to write or install a custom Editor script, add a [MenuItem], build a custom Editor window, or create a one-off Editor helper — to check whether a ready-to-paste template already exists in tooling/<domain>/ before reaching for Unity_CreateScript.
Use when users want to create Canvas, Button, Text, Image, or other UI elements.
Use when users want to find unused assets, duplicate files, or clean up the project.
| name | unity-test |
| description | Use when users want to run Unity tests or read test results. |
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.
test_run or test_run_by_name registers a result callback, calls
TestRunnerApi.Execute(...), and returns { started: true, resultsPath }.TestRunnerApi.Execute does
not. When the run finishes, the registered ICallbacks.RunFinished calls
TestRunnerApi.SaveResultToFile, producing
<project-root>/TestResults/<mode>-mcp.xml. The api + callback are held in a
static so they survive the off-thread run. (No callback ⇒ no file: a bare
Execute starts the run but never writes a report.)test_get_result, test_get_last_result, or test_get_summary
parse the newest matching TestResults/*.xml and 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.
DO NOT (common hallucinations):
test_run_all does not exist → use test_run or test_run_by_name.test_create_template does not exist → use test_create_editmode or
test_create_playmode.test_get_status does not exist → use test_get_result (reads the XML,
stateless).jobId anywhere. If older docs mention one, ignore them.test_cancel — Unity TestRunnerApi has no public hard-cancel
surface.test_smoke_skills — it depended on an upstream REST skill
registry that isn't in this pack.Routing:
editor_get_state (isCompiling field).test_create_editmode / test_create_playmode,
then edit via the script module.test_runKick 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_nameKick 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_resultRead 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_resultNewest XML across all modes. No parameters.
Returns: { success, file, mode, total, passed, failed, skipped, inconclusive, failedNames, startTime, endTime, durationSeconds }
test_get_summaryAggregate every XML report under TestResults/. No parameters.
Returns: { success, totalRuns, totalPassed, totalFailed, totalSkipped, totalInconclusive, allFailedTests, files }
test_listList available tests.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| testMode | string | No | EditMode | EditMode or PlayMode. |
| limit | int | No | 100 | Max tests to list. |
test_list_categoriesList test categories.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| testMode | string | No | EditMode | EditMode or PlayMode. |
test_create_editmodeWrite 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_playmodeWrite 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 }
Recipe path rule: ../../recipes/test/<command>.md
See ../../recipes/test/<command>.md for C# templates.