clayxmen/godot-skills/godot-testing-gut-tdd

Claude Code and agent skill by clayxmen/godot-skills

Trust tier 3
  • community
  • ext:[{"type":"plugin","description":"Custom plugin integration"}]
Source check pending

Checking that the SKILL.md file is still in the repository.

Unit Testing, Integration Testing, and TDD Framework with GUT for Godot 4.x (Godot 4.3+). Implements GutTest test suites, Signal watching and assertions, scene instantiation testing, mock objects, and headless command-line test runners for CI/CD automation. Use this skill whenever: 1. Writing automated unit and integration tests for Godot scripts and components. 2. Testing signal emissions, argument payloads, and event frequencies with `watch_signals()`. 3. Simulating user inputs and async delays with `await wait_for_signal()`. 4. Running headless CLI test suites before commits or in GitHub Actions. 5. Practicing Test-Driven Development (TDD) for gameplay mechanics, inventory, or math systems. Do NOT use when: 1. Manually playtesting visual art without automated assertion criteria. 2. Profiling GPU memory draw calls (use godot-performance-profiling).

Install

npx vskill@latest install clayxmen/godot-skills/godot-testing-gut-tdd

Semi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard

SKILL.md

The same SKILL.md was published earlier as clayxmen/godot-skills/godot-testing-gut-tdd.

πŸ§ͺ Godot 4 Automated Testing & TDD with GUT

This skill provides the standards and templates for writing automated unit, integration, and scene tests using the GUT (Godot Unit Test) framework in Godot 4.x.


πŸ—οΈ 1. Test Architecture & Directory Layout

text
res://
β”œβ”€β”€ test/
β”‚ β”œβ”€β”€ unit/ # Isolated logic tests (Resources, Components, Math)
β”‚ β”‚ β”œβ”€β”€ test_health_component.gd
β”‚ β”‚ β”œβ”€β”€ test_inventory_component.gd
β”‚ β”‚ └── test_goap_planner.gd
β”‚ β”œβ”€β”€ integration/ # Multi-component interaction tests
β”‚ β”‚ β”œβ”€β”€ test_combat_flow.gd
β”‚ β”‚ └── test_quest_progression.gd
β”‚ └── fixtures/ # Mock resources and test scene prefabs
mermaid
flowchart TD
Runner["Headless CLI Runner:\ngodot --headless -s addons/gut/gut_cmdln.gd -gdir=res://test/unit -gexit"]
Runner --> Discovery["Discover all test_*.gd scripts"]
Discovery --> Life["Lifecycle: before_all -> before_each -> test_* -> after_each -> after_all"]
Life --> Assert["Evaluate Assertions:\nassert_eq, assert_true, assert_signal_emitted"]
Assert --> Report["Generate JUnit XML / Console Test Summary"]

πŸ’Ž 2. Production Unit Test: test_health_component.gd

gdscript
# res://test/unit/test_health_component.gd
extends GutTest
var _health_component: HealthComponent = null
func before_each() -> void:
_health_component = HealthComponent.new()
_health_component.max_health = 100.0
_health_component.start_health = 100.0
add_child_autofree(_health_component)
watch_signals(_health_component)
func test_initial_health_matches_max_health() -> void:
assert_eq(_health_component.current_health, 100.0, "Current health should equal max health upon initialization.")
assert_true(_health_component.is_alive(), "Component should report alive.")
func test_apply_damage_decreases_health_and_emits_signals() -> void:
_health_component.apply_damage(35.0)
assert_eq(_health_component.current_health, 65.0, "Health should be reduced to 65.")
assert_signal_emitted(_health_component, "damaged", "damaged signal should fire.")
assert_signal_emitted(_health_component, "health_changed", "health_changed signal should fire.")
assert_signal_not_emitted(_health_component, "health_depleted", "health_depleted should not fire when alive.")
func test_apply_lethal_damage_triggers_death() -> void:
_health_component.apply_damage(150.0)
assert_eq(_health_component.current_health, 0.0, "Health should clamp to 0.")
assert_false(_health_component.is_alive(), "Component should report not alive.")
assert_signal_emitted(_health_component, "health_depleted", "health_depleted signal must fire on fatal hit.")
func test_invulnerable_entity_ignores_damage() -> void:
_health_component.is_invulnerable = true
_health_component.apply_damage(50.0)
assert_eq(_health_component.current_health, 100.0, "Health must not change when invulnerable.")
assert_signal_not_emitted(_health_component, "damaged")

πŸ’Ž 3. Production Inventory Test: test_inventory_component.gd

gdscript
# res://test/unit/test_inventory_component.gd
extends GutTest
var _inventory: InventoryComponent = null
var _test_item: ItemData = null
func before_each() -> void:
_inventory = InventoryComponent.new()
_inventory.max_slots = 4
add_child_autofree(_inventory)
_test_item = ItemData.new()
_test_item.id = &"item_potion"
_test_item.max_stack_size = 5
watch_signals(_inventory)
func test_add_item_stacks_correctly() -> void:
var remainder: int = _inventory.add_item(_test_item, 3)
assert_eq(remainder, 0, "All 3 potions should fit in inventory.")
assert_eq(_inventory.get_item_count(&"item_potion"), 3)
# Add 4 more (should fill first stack to 5 and spill 2 into slot 2)
remainder = _inventory.add_item(_test_item, 4)
assert_eq(remainder, 0)
assert_eq(_inventory.get_item_count(&"item_potion"), 7)
assert_eq(_inventory.slots[0].count, 5, "Slot 0 should be max stacked.")
assert_eq(_inventory.slots[1].count, 2, "Slot 1 should hold the overflow.")
func test_remove_item_by_id() -> void:
_inventory.add_item(_test_item, 4)
var success: bool = _inventory.remove_item_by_id(&"item_potion", 3)
assert_true(success, "Should successfully remove 3 items.")
assert_eq(_inventory.get_item_count(&"item_potion"), 1)

πŸ’» 4. Headless CLI Execution Command

Run test suites automatically in headless terminals or CI pipelines:

powershell
# Run all unit tests headless in Windows PowerShell
& "godot" --headless -s addons/gut/gut_cmdln.gd -gdir="res://test/unit" -gexit

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
5

Not refreshed yet.

Extension points

  • pluginCustom plugin integration

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/clayxmen/godot-skills/godot-testing-gut-tdd/badge)](https://verified-skill.com/skills/clayxmen/godot-skills/godot-testing-gut-tdd)

Something wrong with this skill or its page? Tell us.