Skip to content
Development
Command

/unity-test

Writes missing tests and runs them via MCP. Identifies untested code, creates EditMode/PlayMode tests, executes via run_tests, reports results.

From plugin
everything-claude-unity
2427 skills20 agents27 commands
Install
> /plugin marketplace add XeldarAlz/everything-claude-unity

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/unity-test

Context preview

What this command does when you run it.

Writes missing tests and runs them via MCP. Identifies untested code, creates EditMode/PlayMode tests, executes via run_tests, reports results.

Command definition

unity-test.md
name: unity-test
description: "Writes missing tests and runs them via MCP. Identifies untested code, creates EditMode/PlayMode tests, executes via run_tests, reports results."
user-invocable: true
args: scope

/unity-test — Write and Run Tests

Write tests for the project and execute them via MCP.

Scope

If the user specified a scope: test **$ARGUMENTS** If no scope: identify the most critical untested code paths.

Workflow

Use the `unity-test-runner` agent to:

Step 1: Assess Test Coverage

1. Find existing test assemblies (`.asmdef` files with test references) 2. If no test assemblies exist, create them:

  • `ProjectName.Tests.Editor` — EditMode tests (fast, no scene)
  • `ProjectName.Tests.Runtime` — PlayMode tests (full lifecycle)

3. Identify scripts with public APIs that lack tests 4. Prioritize: gameplay logic > systems > utilities

Step 2: Write Tests

For each untested class/method:

  • **EditMode test** if it's pure logic (no MonoBehaviour lifecycle needed)
  • **PlayMode test** if it involves MonoBehaviour, physics, or scene state
  • Naming: `MethodName_Condition_ExpectedResult`
  • Arrange-Act-Assert pattern
  • Clean up GameObjects in TearDown

Step 3: Run Tests

run_tests → execute all tests (or specific fixture if scoped)
read_console → get test results

Step 4: Report

Present results:

  • Total: X passed, Y failed, Z skipped
  • For failures: test name, expected vs actual, stack trace, suggested fix
  • New tests created: list with file paths
  • Coverage gaps: what still needs testing

Test Priority

1. **Game state logic** — health, damage, scoring, inventory 2. **Input processing** — movement calculation, ability activation 3. **Data systems** — save/load, serialization, configuration 4. **Edge cases** — zero health, empty inventory, null references

Read more
Ships witheverything-claude-unity

The ultimate Claude Code toolkit for Unity game development. A production-ready, plug-and-play system that gives Claude Code deep Unity expertise — from writing performant C# to building scenes, profiling performance, and triggering iOS/Android builds — all

Get the whole plugin

Other commands on everything-claude-unity.