--- paths: - "tests/**" --- # Test Standards - Test naming: `test_[system]_[scenario]_[expected_result]` pattern - Every test must have a clear arrange/act/assert structure - Unit tests must not depend on external state (filesystem, network, database) - Integration tests must clean up after themselves - Performance tests must specify acceptable thresholds and fail if exceeded - Test data must be defined in the test or in dedicated fixtures, never shared mutable state - Mock external dependencies — tests should be fast and deterministic - Every bug fix must have a regression test that would have caught the original bug ## Examples **Correct** (proper naming + Arrange/Act/Assert): ```gdscript func test_health_system_take_damage_reduces_health() -> void: # Arrange var health := HealthComponent.new() health.max_health = 100 health.current_health = 100 # Act health.take_damage(25) # Assert assert_eq(health.current_health, 75) ``` **Incorrect**: ```gdscript func test1() -> void: # VIOLATION: no descriptive name var h := HealthComponent.new() h.take_damage(25) # VIOLATION: no arrange step, no clear assert assert_true(h.current_health < 100) # VIOLATION: imprecise assertion ```