Langsung ke konten
Skillpedia
Testing33k Β· #8503

test-helpers

Fungsinya

Skill ini membuat kode pembantu tes yang bisa dipakai ulang untuk proyek game, disesuaikan dengan engine dan sistemnya. Cocok untuk pengembang yang menulis banyak tes dan ingin lebih sedikit kode pengaturan yang berulang.

Kapan dipakai

  • βœ“Saat sebuah tim telah selesai menyiapkan pengujian dan menginginkan pembantu bersama untuk menulis tes.
  • βœ“Saat pengembang terus mengulang pengaturan dan asersi yang sama di banyak tes.
  • βœ“Saat folder tes engine baru membutuhkan fungsi pembantu awal.

Link skill

https://github.com/Donchitos/Claude-Code-Game-Studios/blob/main/.claude/skills/test-helpers/SKILL.md

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/Donchitos/Claude-Code-Game-Studios/blob/main/.claude/skills/test-helpers/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit β†’

Contoh permintaan ke AI

β€œBuatkan pembantu tes untuk proyek Godot saya agar tes kami membutuhkan lebih sedikit kode pengaturan yang berulang.”

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Skill memeriksa engine dan bahasa proyek, lalu menulis file pembantu untuk pengaturan, asersi, pabrik (factory), dan tiruan di folder yang dipakai oleh penjalan tes engine. Skill meminta persetujuan sebelum membuat perubahan tertentu.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.

!bash "${CLAUDE_SKILL_DIR}/../../hooks/yaml-helper.sh" resolve_config --keys automation

Automation mode: Resolve modes.automation (project.local.yaml β†’ project.yaml β†’ default collaborative). Every AskUserQuestion call and every file write follows .claude/docs/automation-modes.md (collaborative asks always Β· guided major-only Β· autonomous logs and proceeds; automation_always_ask categories always prompt).

Test Helpers

Writing test cases is faster and more consistent when common setup, teardown, and assertion patterns are abstracted into helpers. This skill generates a tests/helpers/ library tailored to the project's actual engine, language, and systems β€” so every developer writes less boilerplate and more assertions.

Output: engine-specific helper files in the engine's helper root β€” the only place its test runner compiles them (.claude/docs/directory-structure.md):

Engine Helper root
Godot tests/helpers/
Unity Assets/Tests/EditMode/Helpers/ β€” inside the EditModeTests assembly /test-setup creates. If PlayMode tests need the same helpers, ask before creating Assets/Tests/Helpers/TestHelpers.asmdef and referencing it from both test assemblies.
Unreal Source/<Module>/Private/Tests/Helpers/

tests/helpers/ below means the helper root for the project's engine.

When to run:

  • After /test-setup scaffolds the framework (first time)
  • When multiple test files repeat the same setup boilerplate
  • When starting to write tests for a new system

Assertions: use the project's test framework, never bare assert()

Generated helpers must assert through the configured test framework's assertion API, resolved from testing.framework β€” not through GDScript's built-in assert().

Two things go wrong with a bare assert() in a helper, and both are silent:

  1. It aborts the run instead of failing the test. A framework assertion records a failure and continues, so one broken expectation yields one red test. A bare assert() halts execution, so the first failure hides every result after it.
  2. It is stripped in release builds. A helper library built on assert() stops asserting entirely in exactly the build you most want checked, and does so without any error β€” the tests still "pass".

Look up the assertion form for the configured framework before generating code. Do not copy the forms in this file or in other skills' examples as authoritative β€” they are illustrative and have drifted (assert_eq, assert_true and assert_that all appear across the repo). If you cannot confirm the correct API for the project's framework, say so and generate no helper rather than guessing.

Helpers must not extend the framework's test-suite base class. A file in tests/helpers/ that extends the suite type is discovered by the runner as a test suite containing zero tests. Helpers are plain classes; only real test files extend the suite.


1. Parse Arguments

Modes:

  • /test-helpers [system-name] β€” generate helpers for a specific system (e.g., /test-helpers combat)
  • /test-helpers all β€” generate helpers for all systems with test files
  • /test-helpers scaffold β€” generate only the base helper library (no system-specific helpers); use this on first run
  • No argument β€” run scaffold if no helpers exist, else all

2. Detect Engine and Language

Read from project.yaml first, falling back to .claude/docs/technical-preferences.md for any key that is absent or empty:

  • engine.name (else the Engine: value)
  • engine.language (else the Language: value)
  • testing.framework (else Framework: from the Testing section)

If the engine is not configured in either source: "Engine not configured. Run /setup-engine first."


3. Load Existing Test Patterns

Scan the engine's test root for patterns already in use (Godot tests/, Unity Assets/Tests/, Unreal Source/<Module>/Private/Tests/):

Glob pattern="tests/**/*_test.*"                  (Godot)
Glob pattern="Assets/Tests/**/*Tests.cs"          (Unity)
Glob pattern="Source/*/Private/Tests/**/*.cpp"    (Unreal)

For a representative sample (up to 5 files), read the test files and extract:

  • Setup patterns (how before_each / setUp / fixtures are written)
  • Common assertion patterns (what is being asserted most often)
  • Object creation patterns (how game objects or scenes are instantiated in tests)
  • Mock/stub patterns (h
Pertanyaan umum

Apakah skill ini bekerja dengan engine apa pun?

Skill disesuaikan dengan engine proyek, seperti Godot, Unity, atau Unreal, dan setiap engine punya folder pembantunya sendiri.

Apakah saya harus menjalankan pengaturan tes dulu?

Ya. Pembantu dibangun di atas kerangka tes, jadi sebaiknya jalankan pengaturan tes terlebih dahulu.

Apakah skill ini menulis tes untuk saya?

Skill menulis kode pembantu untuk mengurangi kode berulang, sedangkan tes itu sendiri ditulis oleh pengembang.

Detail

Deskripsi asli dari pembuat

Generate engine-specific test helper libraries β€” assertion utilities, factory functions, mocks in the engine's test folder. Reduces boilerplate.

repo: Donchitos/Claude-Code-Game-Studios

Popularitas

Bintang GitHub
33k
Peringkat
#8503
Lisensi
MIT
Diperbarui
18/10/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • …

Skill lain dari repositori ini

Skill serupa