Skillpedia
الاختبار33k · #8503

test-helpers

ما الذي تفعله

تنشئ هذه المهارة شيفرة مساعدة قابلة لإعادة الاستخدام في اختبارات مشروع اللعبة، مطابقة لمحركه وأنظمته. وهي موجهة للمطورين الذين يكتبون اختبارات كثيرة ويريدون شيفرة إعداد متكررة أقل.

متى تستخدمها

  • ✓عندما ينتهي الفريق من إعداد الاختبارات ويريد مساعدات مشتركة لكتابتها.
  • ✓عندما يكرر المطورون الإعداد نفسه والتأكيدات نفسها عبر الاختبارات.
  • ✓عندما يحتاج مجلد اختبارات محرك جديد إلى دوال مساعدة أولية.

رابط المهارة

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

انسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.

طريقة الاستخدام

أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.

رسالة جاهزة للصق

استخدم هذه المهارة لمساعدتي: https://github.com/Donchitos/Claude-Code-Game-Studios/blob/main/.claude/skills/test-helpers/SKILL.md اقرأ ملف SKILL.md في هذا الرابط ونفّذ تعليماته لمهمتي.
تريد أن يجد الذكاء الاصطناعي مهارات مثل هذه بنفسه؟ثبّت خادم Skillpedia MCP المجاني: سطر واحد، ويبحث في 15,000+ مهارة قبل كل مهمة.ثبّته في دقيقة واحدة →

مثال على ما تطلبه من الذكاء الاصطناعي

“أنشئ مساعدات اختبار لمشروع Godot الخاص بي، حتى تحتاج اختباراتنا إلى شيفرة إعداد متكررة أقل.”

5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.

كيف تعمل

تتحقق المهارة من محرك المشروع ولغته، ثم تكتب ملفات مساعدة للإعداد والتأكيدات والمصانع والمحاكاة، في المجلد الذي يستخدمه مشغّل اختبارات المحرك. وتطلب تأكيدك قبل بعض التغييرات.

المحتوى التقني (ملف SKILL.md الأصلي)

النص الأصلي من المؤلف، مباشرة من 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
الأسئلة الشائعة

هل تعمل مع أي محرك؟

هي مصممة حسب محرك المشروع، مثل Godot أو Unity أو Unreal، ولكل محرك مجلد مساعدات خاص به.

هل أشغّل إعداد الاختبار أولاً؟

نعم. المساعدات مبنية على إطار الاختبار، فالأفضل أن يُعدّ الاختبار أولاً.

هل تكتب الاختبارات عنّي؟

تكتب شيفرة المساعدة لتقليل التكرار، أما الاختبارات نفسها فيكتبها المطورون.

التفاصيل

الوصف الأصلي من المؤلف

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

الشعبية

نجوم GitHub
33k
الترتيب
#8503
الترخيص
MIT
آخر تحديث
18‏/10‏/2026

هل هذه المهارة مفيدة؟

0

سجّل الدخول للتصويت.

التعليقات

  • …

المزيد من المهارات من هذا المستودع

مهارات مشابهة