Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

unity-test-runner

БесплатноЗапускает вложенные скриптыНе проверен

Execute and analyze Unity Test Framework tests from the command line. This skill automates test execution for Unity projects by detecting the Unity Editor…

Dev-GOMот Dev-GOM★ 97 звёзд на GitHub26 установок в других каталогах

Об этом скилле

Unity Test Runner

Overview

This skill enables automated execution and analysis of Unity Test Framework tests directly from the command line. It handles the complete test workflow: detecting Unity Editor installations across platforms (Windows/macOS/Linux), configuring test parameters, executing tests in EditMode or PlayMode, parsing NUnit XML results, and generating detailed failure reports with actionable insights.

When to Use This Skill

Use this skill when:

  • Executing Unity Test Framework tests from command line
  • Running PlayMode or EditMode tests for game logic validation
  • Analyzing test failures and generating failure reports
  • Integrating Unity tests into CI/CD pipelines
  • Debugging test failures with detailed stack traces and file locations
  • Validating Unity project changes before commits

Example user requests:

  • "Run all Unity tests in my project"
  • "Execute PlayMode tests and show me the results"
  • "Run tests in the Combat category"
  • "Check if my Unity tests are passing"
  • "Run EditMode tests only"

Workflow

Follow this workflow when the skill is invoked:

1. Detect Unity Editor Installation

Use the find-unity-editor.js script to automatically locate the Unity Editor:

node scripts/find-unity-editor.js --json

Script behavior:

  • Scans platform-specific default installation paths
  • Detects all installed Unity versions
  • Returns the latest version by default
  • Can target specific version with --version <version> flag

Output:

{
  "found": true,
  "editorPath": "C:\\Program Files\\Unity\\Hub\\Editor\\2021.3.15f1\\Editor\\Unity.exe",
  "version": "2021.3.15f1",
  "platform": "win32",
  "allVersions": ["2021.3.15f1", "2020.3.30f1"]
}

If multiple versions are found:

  1. Present all available versions to the user
  2. Ask user to confirm which version to use
  3. Or use the latest version by default

If no Unity Editor is found:

  • Report error with searched paths
  • Ask user to provide Unity Editor path manually
  • Store the path for future use

2. Verify Unity Project Path

Confirm the current directory contains a valid Unity project using cross-platform checks:

// Use Read tool to check for Unity project indicators
Read({ file_path: "ProjectSettings/ProjectVersion.txt" })

// Use Glob to verify Assets directory exists
Glob({ pattern: "Assets/*", path: "." })

Validation steps:

  1. Verify Assets/ directory exists
  2. Verify ProjectSettings/ProjectVersion.txt exists
  3. Read ProjectVersion.txt to get Unity version
  4. Warn if Editor version doesn't match project version

Example ProjectVersion.txt:

m_EditorVersion: 2021.3.15f1
m_EditorVersionWithRevision: 2021.3.15f1 (e8e88743f9e5)

3. Configure Test Settings

Determine test execution parameters. Use AskUserQuestion tool if parameters are not specified:

Required settings:

  • Test Mode: EditMode, PlayMode, or Both
  • Test Platform: EditMode tests use "EditMode", PlayMode can specify platform (e.g., "StandaloneWindows64", "Android", "iOS")

Optional settings:

  • Test Categories: Semicolon-separated list (e.g., "Combat;AI;Physics")
  • Test Filter: Regex pattern or semicolon-separated test names
  • Results Output Path: Default to TestResults.xml in project root

Configuration example:

AskUserQuestion({
  questions: [{
    question: "Which test mode should be executed?",
    header: "Test Mode",
    multiSelect: false,
    options: [
      { label: "EditMode Only", description: "Fast unit tests without Play Mode" },
      { label: "PlayMode Only", description: "Full Unity engine tests" },
      { label: "Both Modes", description: "Run all tests (slower)" }
    ]
  }]
})

4. Execute Tests via Command Line

Build and execute the Unity command line test command:

Command structure:

<UnityEditorPath> -runTests -batchmode -projectPath <ProjectPath> \
  -testPlatform <EditMode|PlayMode> \
  -testResults <OutputPath> \
  [-testCategory <Categories>] \
  [-testFilter <Filter>] \
  -logFile -

Example commands:

EditMode tests:

"C:\Program Files\Unity\Hub\Editor\2021.3.15f1\Editor\Unity.exe" \
  -runTests -batchmode \
  -projectPath "D:\Projects\MyGame" \
  -testPlatform EditMode \
  -testResults "TestResults-EditMode.xml" \
  -logFile -

PlayMode tests with category filter:

"C:\Program Files\Unity\Hub\Editor\2021.3.15f1\Editor\Unity.exe" \
  -runTests -batchmode \
  -projectPath "D:\Projects\MyGame" \
  -testPlatform PlayMode \
  -testResults "TestResults-PlayMode.xml" \
  -testCategory "Combat;AI" \
  -logFile -

Execution notes:

  • Use Bash tool with run_in_background: true for long-running tests
  • Set timeout appropriately (default: 5-10 minutes, adjust based on test count)
  • Monitor output for progress indicators
  • Capture both stdout and stderr

Example execution:

Bash({
  command: `"${unityPath}" -runTests -batchmode -proj
Полный SKILL.md на GitHub

Установить unity-test-runner в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

references/test-patterns.jsonscripts/find-unity-editor.jsscripts/parse-test-results.js

FAQ

Что делает скилл unity-test-runner?

Execute and analyze Unity Test Framework tests from the command line. This skill automates test execution for Unity projects by detecting the Unity Editor, configuring test parameters (EditMode/PlayMode), running tests via CLI, parsing XML results, and generating detailed failure reports. Use this when running Unity tests, validating game logic, or debugging test failures.

Как установить скилл unity-test-runner?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл unity-test-runner запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить unity-test-runner с