Before calling any skill in this module: if you are about to call a skill with parameters guessed from its name or description, STOP — read this file (or fetch its schema via
GET /skills/recommend?includeSchema=true
) first. If you already have the parameter definitions from recommend/schema, you may proceed straight to dryRun.
Triggers
- Running EditMode/PlayMode tests
- Discovering or listing tests
- Polling async test results
- Scaffolding test files
- 运行 EditMode/PlayMode 测试、发现或列出测试、轮询异步测试结果、生成测试文件
Test Skills
Run and manage Unity tests.
Operating Mode
-
Approval: 只读 skill(
/
/
/
/
/
/
,标
)直接执行;执行/发现/创建型 skill(
/
/
/
/
/
,默认
)需用户 grant,grant 后服务端一步执行返结果(job 立即排进队列)。
-
Auto / Bypass: 直接执行。
-
本模块有 4 个 NeverInSemi skill(按
自动判定):
Approval 模式下这 4 个返
,仅 Bypass 或 Allowlist 命中可绕过。注意:
test_run(testMode="PlayMode")
/
会让 Unity TestRunner 切入 PlayMode;
/
落盘新的 .cs 文件后会触发 Domain Reload。
-
异步约定:
/
/
/
立即返回
;用
/
test_discover_get_result(jobId)
轮询;Unity TestRunner 串行化,
正在跑测试时不要再起第二个 。
DO NOT (common hallucinations):
- does not exist → use or
- does not exist → use or
- does not exist → use with from test run
- Test skills are async — they return a , poll with
- Unity Test Runner is serialized here: do not start a second while another test job is still active
- Prefer
unity_skills.get_skills(category="Test")
or for exact signatures instead of guessing from memory
Routing:
- For compile error checking → use module's
- For test script creation → / , then modify via module
- For broad regression probes across many skills → , which uses transient probes to avoid polluting workflow/batch persistence
Skills
List available tests via Unity Test Runner async discovery.
Returns + on first call (cache miss) — poll
test_discover_get_result(jobId)
then retry
.
Parameters:
- (string, optional): EditMode or PlayMode. Default: EditMode.
- (int, optional): Max tests to list. Default: 100.
Returns: { success, testMode, count, total, truncated, tests, pendingDiscovery, discoveryJobId, discoveryStatus }
— here
is how many came back and
is how many were discovered,
means raise
. (
uses
for the total instead — see the warning there.)
Run Unity tests asynchronously. Returns a
immediately; poll with
.
Parameters:
- (string, optional): EditMode or PlayMode. Default: EditMode.
Returns:
{ success, status, jobId, kind, testMode, filter, message }
Get the result of a test run.
Parameters:
- (string, required): Job ID from / .
Returns: { success, jobId, status, totalTests, passedTests, failedTests, skippedTests, inconclusiveTests, otherTests, failedTestNames, failedTestDetails, elapsedSeconds, resultSummary, error }
— each failure detail includes
,
,
,
,
, and
.
Cancel a running test job if supported (Unity TestRunner has no hard cancel — best-effort).
Parameters:
- (string, required): Job ID to cancel.
Returns: { success, jobId, status, cancelled, note, warnings }
Start asynchronous Unity Test Runner discovery and return a discovery
. Use this directly when you want explicit control over discovery; otherwise
/
will trigger it on cache miss.
| Parameter | Type | Required | Default | Description |
|---|
| testMode | string | No | EditMode | EditMode or PlayMode |
Returns: { success, status, jobId, kind, testMode, message }
Get the result of an asynchronous Unity Test Runner discovery job.
| Parameter | Type | Required | Default | Description |
|---|
| jobId | string | Yes | - | Discovery job ID |
| limit | int | No | 100 | Max tests in the response; the default silently caps a larger suite |
Returns: { success, jobId, status, testMode, discoveryMode, count, returned, truncated, tests, error }
Here is the total and is what you got. is how many tests the discovery found,
is how many are in
after
was applied,
says the two differ — raise
to see the rest. A project with 300 tests answers
count: 300, returned: 100, truncated: true
under the default. Never derive the suite size from
.
⚠️
means the opposite thing in . There
is the
returned length and
is the discovered size; here
is the
discovered size and
is the returned length. The two skills were shipped that way and each one's
is frozen for wire compatibility, so do not assume symmetry — read
(present on both) to know whether you are looking at a partial list, and take the total from
in
but from
here.
Run specific tests by class or method name.
| Parameter | Type | Required | Default | Description |
|---|
| testName | string | Yes | - | Test class or method name to run |
| testMode | string | No | EditMode | EditMode or PlayMode |
Returns: { success, jobId, testName, testMode }
Get the most recent test run result.
No parameters.
Returns: { jobId, status, total, passed, failed, skipped, inconclusive, other, failedNames }
List test categories via Unity Test Runner async discovery. Same cache-miss / poll pattern as
.
| Parameter | Type | Required | Default | Description |
|---|
| testMode | string | No | EditMode | EditMode or PlayMode |
Returns: { success, count, categories, pendingDiscovery, discoveryJobId, discoveryStatus }
Run a reusable smoke test across registered skills.
| Parameter | Type | Required | Default | Description |
|---|
| category | string | No | - | Only test one skill category |
| nameContains | string | No | - | Filter skills by partial name |
| excludeNamesCsv | string | No | - | Comma-separated skill names to exclude |
| executeReadOnly | bool | No | true | Execute safe read-only skills directly |
| includeMutating | bool | No | true | Include mutating skills via dryRun smoke testing |
| limit | int | No | 0 | Max skills to inspect; 0 means all |
Returns: { success, totalSkills, executedCount, dryRunCount, failureCount, results }
Create an EditMode test script template. Writes the .cs file synchronously and returns a compile-monitor
; the script create
will trigger a Domain Reload, so the server may be temporarily unavailable —
carries the transient-unavailable hint.
| Parameter | Type | Required | Default | Description |
|---|
| testName | string | Yes | - | Name of the test class to create |
| folder | string | No | Assets/Tests/Editor | Folder path for the test script |
Returns: { success, status, path, testName, jobId, serverAvailability }
Create a PlayMode test script template. Writes the .cs file synchronously and returns a compile-monitor
; same Domain Reload + transient-unavailable note as
.
| Parameter | Type | Required | Default | Description |
|---|
| testName | string | Yes | - | Name of the test class to create |
| folder | string | No | Assets/Tests/Runtime | Folder path for the test script |
Returns: { success, status, path, testName, jobId, serverAvailability }
Get aggregated test summary across all runs.
No parameters.
Returns: { success, totalRuns, completedRuns, totalPassed, totalFailed, totalSkipped, totalInconclusive, totalOther, allFailedTests }
Minimal Example
python
import unity_skills, time
# Run tests and poll for result (async pattern required)
result = unity_skills.call_skill("test_run", testMode="EditMode")
job_id = result["jobId"]
# Poll until done (test_* skills are async)
for _ in range(30):
status = unity_skills.call_skill("test_get_result", jobId=job_id)
if status.get("status") == "Completed":
print(f"Passed: {status['totalPassed']}, Failed: {status['totalFailed']}")
break
time.sleep(2)
Exact Signatures
Exact names, parameters, defaults, and returns are defined by
or
unity_skills.get_skill_schema()
, not by this file.