mcpField
G
godot-testing-patterns

godot-testing-patterns

github.com/thedivergentaiTesting & quality907586 installsUpdated 2w ago
Repository

About godot-testing-patterns

A Godot testing skill for developers building automated tests with GdUnit4. It maps common testing needs to scripts for unit, scene, async, network, snapshot, headless CI, performance, and leak checks.

Key features

  1. 01单元与场景集成测试
  2. 02信号、帧与物理步骤测试
  3. 03无显示环境下的 CI 测试
  4. 04快照对比与模拟网络测试
  5. 05性能基准、泄漏检测与模糊测试

Use cases

  1. 01测试纯逻辑和节点交互
  2. 02在 CI 中运行无头测试
  3. 03验证信号、物理和 RPC 行为
  4. 04检查 UI 快照、性能预算与节点泄漏

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/thedivergentai/game-dev-agentic-skills --skill godot-testing-patterns

After installing, type/godot-testing-patternsin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

references/
expert-testing-patterns.md
manual-testing-checklist.md
migration-notes.md
scripts/
basic_unit_test.gd
headless_test_runner.gd
integration_test_base.gd
memory_leak_detector.gd
mock_dependency_test.gd
mock_network_provider.gd
parameter_fuzz_tester.gd
performance_benchmark_runner.gd
physics_collision_test.gd
scene_integration_test.gd
signal_emission_test.gd
snapshot_tester.gd
test_data_factory.gd
wait_for_frame_test.gd

Details

From the project README

Decision Tree → Scripts

NeedChoiceScript (MANDATORY when chosen)
Pure logic / no treeUnitbasic_unit_test.gd, mock_dependency_test.gd, test_data_factory.gd
Node interaction after instantiateScene integrationscene_integration_test.gd, integration_test_base.gd
Signal contractsUnit or scenesignal_emission_test.gd
Multi-frame / physics stepAsync scenewait_for_frame_test.gd, physics_collision_test.gd
Flaky physics / timing racesFrame step gateMANDATORY wait_for_frame_test.gd — never wall-clock sleep
CI / no displayHeadless gateMANDATORY headless_test_runner.gd
Save/UI regressionSnapshotMANDATORY snapshot_tester.gd
RPC without live peersMock networkMANDATORY mock_network_provider.gd
Perf budget in CIBenchmark gateperformance_benchmark_runner.gd
Orphans after suiteLeak detectmemory_leak_detector.gd
Edge input spaceFuzzparameter_fuzz_tester.gd

Do NOT Load assert-catalog tutorials or manual gameplay checklists into context — pick a row, read the script, implement.

MANDATORY Triggers

  • CI / --headless: always read headless_test_runner.gd first (OS.exit_code, GdUnit4 CLI: godot --headless -s addons/gdUnit4/bin/GdUnitCmdTool.gd -a res://test).
  • State or visual golden files: read snapshot_tester.gd before writing JSON/image goldens. Approve workflow: first run saves reference; intentional UI change → delete or overwrite res://tests/snapshots/<name>.png, re-run to regenerate, commit new golden; never hand-edit PNG bytes.
  • Any RPC / MultiplayerSynchronizer test: read mock_network_provider.gd before standing up real peers.

Available Scripts

basic_unit_test.gd

Minimal GdUnit4 (GdUnitTestSuite) structure for pure logic.

signal_emission_test.gd

Signal emission monitoring for decoupled architectures.

mock_dependency_test.gd

Mocks/doubles to isolate external services.

scene_integration_test.gd / integration_test_base.gd

Scene lifecycle + node interaction fixtures.

headless_test_runner.gd

CI headless orchestration and exit codes.

snapshot_tester.gd

Dictionary/UI golden snapshot comparison.

mock_network_provider.gd

Loopback / offline multiplayer peer for RPC tests.

performance_benchmark_runner.gd

Microsecond timers + Performance monitor gates.

memory_leak_detector.gd

Orphan node detection across long suites.

parameter_fuzz_tester.gd

Randomized ranges for edge crashes.

wait_for_frame_test.gd / physics_collision_test.gd

Frame/physics-step async verification.

test_data_factory.gd

Schema-compliant fixture builders.

NEVER Do in Testing (GdUnit4)

  • NEVER test private implementation details — Assert public behavior only.
  • NEVER share mutable state between tests — Fresh setup per test (before_test / equivalent).
  • NEVER use wall-clock sleep / blind timers — Prefer frame steppers from wait_for_frame patterns.
  • NEVER skip cleanup — Free instantiated nodes after each test.
  • NEVER test randomness without seeding.
  • NEVER assert signals without the GdUnit signal assert/monitor helpers from signal_emission_test.gd.
  • NEVER mix GUT and GdUnit4 APIs in one suite.
  • NEVER rely on editor-only features for CI — Headless-compatible tests only.
  • NEVER default to full-level integration tests — Prefer unit + small scene tests; escalate only when the decision tree says so.
  • NEVER hardcode brittle absolute file paths in fixtures.
  • NEVER test third-party plugin internals — Test your integration only.

Expert Gates (short)

  • Snapshot: serialize → compare golden (snapshot_tester.gd); regenerate reference PNG on approved visual changes.
  • CI: --headless + OS.exit_code non-zero on failure (headless_test_runner.gd).
  • Network: mock peer before real ENet (mock_network_provider.gd).
  • Perf: Performance monitors / draw-call caps in benchmark runner.

Deep recipes (on demand)

LLM-ignorance rule: if a general agent would not know it before reading, it lives here or in scripts/ — never delete, only move.

TopicReference
Snapshot / CI / fuzz / perfexpert-testing-patterns.md
Release smoke checklistmanual-testing-checklist.md

Reference

Progressive disclosure: open Official Documentation links only when researching a specific API; load Related Skills when routing to a peer domain — do not preload the whole lattice.

Official Documentation
Related Skills
Prerequisites
Complements
Downstream / consumers
Master
  • godot-master — library router and mirrored module entry for cross-skill discovery.

Comments

Markdown supported