godot-testing-patterns

Implements GdUnit4 test suites, headless CI runners, snapshots, and mock networks for Godot projects.

Updated Aug 22, 2026
One-click install
npx skills add https://github.com/DecioLuvier/Shatterless --skill godot-testing-patterns-decioluvier
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: godot-testing-patterns
Source: https://github.com/DecioLuvier/Shatterless/tree/main/.claude/skills/godot/references/godot-testing-patterns
Command: npx skills add https://github.com/DecioLuvier/Shatterless --skill godot-testing-patterns-decioluvier

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve? Choosing the right test layer and wiring reliable automated tests in Godot is hard: teams mix GUT and GdUnit4 APIs, rely on wall-clock sleeps that flake in CI, and stand up real network peers just to test RPCs. This Skill provides decision trees and ready-made GdUnit4 script patterns so every test lands in the correct layer with deterministic execution. ## Core Features & Use Cases - Test Layer Decision Tree: Routes work to unit, scene integration, async physics, snapshot, fuzz, benchmark, leak-detection, or mock-network patterns with mandatory script references. - Headless CI Gates: Provides the godot --headless GdUnit4 CLI runner pattern with non-zero exit codes for pipeline integration. - Snapshot and Golden Testing: Covers JSON state goldens and viewport image regression with an approve-by-regeneration workflow. - Use Case: When adding multiplayer RPC tests to a Godot 4 project, the Skill directs you to a mock OfflineMultiplayerPeer pattern instead of real ENet peers, keeping tests fast and deterministic in CI. ## Quick Start Ask the agent to set up a GdUnit4 headless CI test suite for your Godot project using the testing decision tree.

Frequently Asked Questions about godot-testing-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run GdUnit4 tests headless in CI for Godot?▼

Run GdUnit4 headless with `godot --headless -s addons/gdUnit4/bin/GdUnitCmdTool.gd -a res://test` and propagate failures through a non-zero OS.exit_code. The headless_test_runner.gd script pattern orchestrates this so pipelines fail correctly on red tests.

How to test multiplayer RPC in Godot without real network peers?▼

Test RPC logic with a mock network provider using a loopback or OfflineMultiplayerPeer before standing up real ENet connections. This keeps MultiplayerSynchronizer and RPC tests deterministic and fast in CI environments.

GdUnit4 vs GUT for Godot testing — can I mix them?▼

Never mix GUT and GdUnit4 APIs in one suite; this Skill is GdUnit4-only using `extends GdUnitTestSuite`. Legacy GUT snippets should be migrated by mapping their asserts to GdUnit4 equivalents.

Why are my Godot physics tests flaky in CI?▼

Flaky physics tests usually come from wall-clock sleeps and blind timers instead of frame-stepped waiting. Use wait_for_frame patterns that yield on physics frames so timing races disappear across machines.

How do I do snapshot or golden-file testing in Godot?▼

Serialize state to a Dictionary and compare against golden JSON, or capture the viewport after RenderingServer.frame_post_draw and byte-compare to a reference PNG. Approve intentional changes by regenerating goldens, never hand-editing PNG bytes.

When should I not write full-level integration tests in Godot?▼

Avoid defaulting to full-level integration tests; prefer unit tests for pure logic and small scene integration tests for node interaction. Escalate to larger integration tests only when the decision tree indicates multi-frame physics or cross-scene behavior.