gdunit4-test-writer

minami110's avatarfrom minami110

Write gdUnit4 test code with type-specific assertions, signal testing, and scene runner support. Use when creating or updating tests for GDScript files.

⭐0stars🔀0forks📁View on GitHub🕐Updated Dec 17, 2025

When & Why to Use This Skill

The gdUnit4 Test Writer is a specialized Claude skill designed to automate and streamline the creation of comprehensive test suites for Godot Engine projects. It empowers developers to generate high-quality GDScript test code featuring type-specific assertions, signal monitoring, and complex scene simulations, ensuring robust game logic and high software reliability.

Use Cases

  • Automated Unit Testing: Quickly generate structured test cases for GDScript classes and functions to validate core logic and prevent regressions during development.
  • Signal and Event Verification: Use specialized assertions to ensure that game events and signals are emitted correctly and carry the expected data.
  • Integration Testing with Scene Runner: Simulate real-world game scenarios and node interactions within the Godot environment to test how different components work together.
  • Memory Management Optimization: Automatically implement 'auto_free' patterns in test suites to prevent memory leaks and maintain a clean testing environment.
namegdUnit4 Test Writer
descriptionWrite gdUnit4 test code with type-specific assertions, signal testing, and scene runner support. Use when creating or updating tests for GDScript files.

gdUnit4 Test Writer

Write gdUnit4 test code for GDScript files with proper assertions and test structure.

Workflow

  1. Analyze target file - Read the GDScript file to understand what needs testing
  2. Check gdUnit4 docs - Use Context7 (/websites/godot-gdunit-labs_github_io_gdunit4) if needed
  3. Select assertions - Use type-specific assertions (see [references/assertions.md])
  4. Create test file - Place in res://tests/ directory with test_*.gd naming (e.g., test_player.gd)
  5. Validate - Use gdscript-validate skill to check for errors

Quick Reference

Test File Template

extends GdUnitTestSuite

func test_example() -> void:
    assert_int(1).is_equal(1)

Common Assertions

  • int: assert_int(value).is_equal(10)
  • float: assert_float(value).is_equal_approx(3.14, 0.01)
  • String: assert_str(text).contains("hello")
  • Array: assert_array(items).has_size(5)
  • Object: assert_object(node).is_not_null()
  • Signal: await assert_signal(emitter).is_emitted("signal_name")

Memory Management

func test_with_node() -> void:
    var node: Node = auto_free(Node.new())  # Auto-freed after test
    assert_object(node).is_not_null()

References

Context7 Library ID

For detailed gdUnit4 documentation:

  • Library ID: /websites/godot-gdunit-labs_github_io_gdunit4