mcpField
G
gds-test-framework

gds-test-framework

github.com/bmad-code-orgテスト・品質26245 回インストール5 週間前に更新
リポジトリ

gds-test-framework について

gds-test-frameworkは、Unity、Unreal Engine、Godotのゲームプロジェクト向けにテスト環境を構築するスキルです。エンジンを判別し、対応する設定、サンプルテスト、説明文書を作成します。

主な機能

  1. 01Unity、Unreal、Godotの判別
  2. 02エンジンに合わせたテスト構成の作成
  3. 03設定ファイルとサンプルテストの生成
  4. 04テスト実行方法とプラクティスの文書化

活用シーン

  1. 01ゲームプロジェクトへのテスト環境導入
  2. 02エンジンに応じた初期テストの作成
  3. 03ローカルとCIでのテスト手順の文書化

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/bmad-code-org/bmad-module-game-dev-studio --skill gds-test-framework

インストール後、Claude Code で/gds-test-frameworkを入力して読み込まれたか確認します。

同梱ファイルchecklist.mdcustomize.toml

詳細

ゲームテストフレームワークのセットアップ

ワークフロー ID:gds-test-framework バージョン:1.0 (BMad v6)

規約

  • ベアパス(例:template.md)は、スキルのルートから解決されます。
  • {skill-root} は、このスキルのインストール先ディレクトリ(customize.toml が配置されている場所)に解決されます。
  • {project-root} は、プロジェクトの作業ディレクトリから親ディレクトリをたどって見つかる、_bmad/ を含む最も近いフォルダーに解決されます。
  • {skill-name} は、スキルディレクトリのベース名に解決されます。

有効化時

ステップ 1:ワークフローブロックを解決する

実行:uv run {project-root}/_bmad/scripts/resolve_customization.py --skill {skill-root} --project-root {project-root} --key workflow

スクリプトが失敗した場合は、次の 3 つのファイルを base → team → user の順に読み込み、リゾルバーと同じ構造マージルールを適用して、workflow ブロックを自分で解決してください。

  1. {skill-root}/customize.toml — デフォルト
  2. {project-root}/_bmad/custom/{skill-name}.toml — チームによる上書き
  3. {project-root}/_bmad/custom/{skill-name}.user.toml — 個人による上書き

ファイルが存在しない場合はスキップします。スカラー値は上書きされ、テーブルはディープマージされ、code または id をキーとするテーブルの配列は一致する項目を置き換えて新しい項目を追加し、それ以外の配列はすべて追記されます。

ステップ 2:先頭追加ステップを実行する

続行する前に、{workflow.activation_steps_prepend} の各項目を順番に実行します。

ステップ 3:永続的な事実を読み込む

{workflow.persistent_facts} の各項目を、ワークフロー実行中に保持する基盤コンテキストとして扱います。file: で始まる項目は、{project-root} 配下のパスまたはグロブとして扱い、参照先の内容を事実として読み込みます。それ以外の項目は、そのまま事実として扱います。

ステップ 4:設定を読み込む

{project-root}/_bmad/gds/config.yaml から設定を読み込み、次の値を解決します。

  • user_name
  • communication_language
ステップ 5:ユーザーに挨拶する

{communication_language} で話し、{user_name} に挨拶します。

ステップ 6:末尾追加ステップを実行する

{workflow.activation_steps_append} の各項目を順番に実行します。

有効化が完了しました。activation_steps_prepend または activation_steps_append に項目がある場合は、各項目を順番どおりに実行したことを確認してから続行します。有効化ステップをすべて完了するまで、メインワークフローを開始しないでください。

目標

Unity、Unreal Engine、または Godot プロジェクト向けに、本番環境で使用できるゲームテストフレームワークを初期化します。このワークフローでは、検出されたゲームエンジンに適したユニットテスト、統合テスト、プレイモードテストを含む、完全なテスト基盤を構築します。

役割

あなたはテスト基盤を専門とするゲーム QA アーキテクトです。使用中のゲームエンジンを検出し、適切なテストフレームワークを構築し、動作するサンプルテストを生成して、ドキュメントを作成します。チームが初日から完全に機能するテスト環境を利用できるようにします。


ワークフローの構成

このワークフローはゲームエンジンを検出し、必要なテスト基盤ファイルをすべてゲームプロジェクト内に直接作成します。

主な出力:{test_dir}/README.md

補助コンポーネント:

  • 検証:{installed_path}/checklist.md

ナレッジベースの参照先:

  • knowledge/unity-testing.md
  • knowledge/unreal-testing.md
  • knowledge/godot-testing.md

{module_config} から設定を読み込み、解決します。

output_folder: {from config}
user_name: {from config}
communication_language: {from config}
document_output_language: {from config}
game_dev_experience: {from config}
date: {system-generated}

ワークフロー変数を解決します。

test_dir: "{project-root}/tests"    # Root test directory
game_engine: "auto"                  # auto | unity | unreal | godot
test_framework: "auto"               # auto | gut (godot) | unity-test-framework | unreal-automation

実行

事前確認の要件

重要: 続行する前に、これらの要件を確認してください。いずれかを満たさない場合は、処理を中断してユーザーに通知します。

  • ゲームプロジェクトが存在し、使用エンジンを特定できること
  • テストフレームワークがすでに設定されていないこと(既存のテストディレクトリを確認)
  • プロジェクト構成にアクセスできること

ステップ 1:ゲームエンジンを検出する
アクション
  1. エンジンの種類を特定する

    エンジン固有のファイルを確認します。

    • Unity:Assets/、ProjectSettings/ProjectSettings.asset、*.unity シーンファイル
    • Unreal:*.uproject、Source/、Config/DefaultEngine.ini
    • Godot:project.godot、*.tscn、*.gd ファイル
  2. エンジンのバージョンを確認する

    • Unity:ProjectSettings/ProjectVersion.txt を確認します
    • Unreal:*.uproject ファイルの EngineAssociation を確認します
    • Godot:project.godot の config_version を確認します
  3. 既存のテストフレームワークを確認する

    • Unity:Tests/ フォルダー、*.Tests.asmdef を確認します
    • Unreal:Source 内の Tests/、*Tests.Build.cs を確認します
    • Godot:tests/ フォルダー、addons/gut/ 内の GUT プラグインを確認します

停止条件: 既存のフレームワークが検出された場合は、アップグレード方法を提示するか、処理を停止します。


ステップ 2:フレームワークを構築する
Unity Test Framework

ナレッジベースの参照先:knowledge/unity-testing.md

  1. ディレクトリ構造を作成する

    Assets/
    ├── Tests/
    │   ├── EditMode/
    │   │   ├── EditModeTests.asmdef
    │   │   └── ExampleEditModeTest.cs
    │   └── PlayMode/
    │       ├── PlayModeTests.asmdef
    │       └── ExamplePlayModeTest.cs
    
  2. アセンブリ定義を生成する

    EditModeTests.asmdef:

    {
      "name": "EditModeTests",
      "references": ["<GameAssembly>"],
      "includePlatforms": ["Editor"],
      "defineConstraints": ["UNITY_INCLUDE_TESTS"],
      "optionalUnityReferences": ["TestAssemblies"]
    }
    

    PlayModeTests.asmdef:

    {
      "name": "PlayModeTests",
      "references": ["<GameAssembly>"],
      "includePlatforms": [],
      "defineConstraints": ["UNITY_INCLUDE_TESTS"],
      "optionalUnityReferences": ["TestAssemblies"]
    }
    
  3. サンプルテストを生成する

    Edit Mode テストの例:

    using NUnit.Framework;
    
    [TestFixture]
    public class DamageCalculatorTests
    {
        [Test]
        public void Calculate_BaseDamage_ReturnsCorrectValue()
        {
            // Arrange
            var calculator = new DamageCalculator();
    
            // Act
            float result = calculator.Calculate(100f, 1f);
    
            // Assert
            Assert.AreEqual(100f, result);
        }
    }
    

    Play Mode テストの例:

    using System.Collections;
    using NUnit.Framework;
    using UnityEngine;
    using UnityEngine.TestTools;
    
    public class PlayerMovementTests
    {
        [UnityTest]
        public IEnumerator Player_WhenInputApplied_Moves()
        {
            // Arrange
            var playerGO = new GameObject("Player");
            var controller = playerGO.AddComponent<PlayerController>();
    
            // Act
            controller.SetMoveInput(Vector2.right);
            yield return new WaitForSeconds(0.5f);
    
            // Assert
            Assert.Greater(playerGO.transform.position.x, 0f);
    
            // Cleanup
            Object.Destroy(playerGO);
        }
    }
    

Unreal Engine Automation

ナレッジベースの参照先:knowledge/unreal-testing.md

  1. ディレクトリ構造を作成する

    Source/
    ├── <ProjectName>/
    │   └── ...
    └── <ProjectName>Tests/
        ├── <ProjectName>Tests.Build.cs
        └── Private/
            ├── DamageCalculationTests.cpp
            └── PlayerCombatTests.cpp
    
  2. モジュールのビルドファイルを生成する

    <ProjectName>Tests.Build.cs:

    using UnrealBuildTool;
    
    public class <ProjectName>Tests : ModuleRules
    {
        public <ProjectName>Tests(ReadOnlyTargetRules Target) : base(Target)
        {
            PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
    
            PublicDependencyModuleNames.AddRange(new string[] {
                "Core",
                "CoreUObject",
                "Engine",
                "<ProjectName>"
            });
    
            PrivateDependencyModuleNames.AddRange(new string[] {
                "AutomationController"
            });
        }
    }
    
  3. サンプルテストを生成する

    #include "Misc/AutomationTest.h"
    
    IMPLEMENT_SIMPLE_AUTOMATION_TEST(
        FDamageCalculationTest,
        "<ProjectName>.Combat.DamageCalculation",
        EAutomationTestFlags::ApplicationContextMask |
        EAutomationTestFlags::ProductFilter
    )
    
    bool FDamageCalculationTest::RunTest(const FString& Parameters)
    {
        // Arrange
        float BaseDamage = 100.f;
        float CritMultiplier = 2.f;
    
        // Act
        float Result = UDamageCalculator::Calculate(BaseDamage, CritMultiplier);
    
        // Assert
        TestEqual("Critical hit doubles damage", Result, 200.f);
    
        return true;
    }
    

Godot GUT Framework

ナレッジベースの参照先:knowledge/godot-testing.md

  1. ディレクトリ構造を作成する

    project/
    ├── addons/
    │   └── gut/ (plugin files)
    ├── tests/
    │   ├── unit/
    │   │   └── test_damage_calculator.gd
    │   └── integration/
    │       └── test_player_combat.gd
    └── gut_config.json
    
  2. GUT の設定を生成する

    gut_config.json:

    {
      "dirs": ["res://tests/"],
      "include_subdirs": true,
      "prefix": "test_",
      "suffix": ".gd",
      "should_exit": true,
      "should_exit_on_success": true,
      "log_level": 1,
      "junit_xml_file": "results.xml"
    }
    
  3. サンプルテストを生成する

    tests/unit/test_damage_calculator.gd:

    extends GutTest
    
    var calculator: DamageCalculator
    
    func before_each():
        calculator = DamageCalculator.new()
    
    func after_each():
        calculator.free()
    
    func test_calculate_base_damage():
        var result = calculator.calculate(100.0, 1.0)
        assert_eq(result, 100.0, "Base damage should equal input")
    
    func test_calculate_critical_hit():
        var result = calculator.calculate(100.0, 2.0)
        assert_eq(result, 200.0, "Critical hit should double damage")
    

ステップ 3:ドキュメントを生成する

以下を含む tests/README.md を作成します。

  • 検出されたエンジン向けのテストフレームワークの概要
  • ディレクトリ構造の説明
  • ローカルでのテストの実行方法
  • CI 統合用コマンド
  • ゲームテストのベストプラクティス
  • ナレッジベースの関連箇所へのリンク

ステップ 4:成果物
作成される主な成果物
  1. ディレクトリ構造 — エンジンに適したテストフォルダー
  2. 設定ファイル — フレームワーク固有の設定(asmdef、Build.cs、gut_config.json)
  3. サンプルテスト — 単体テストおよび統合テストの実行可能な例
  4. ドキュメント — tests/README.md

出力の概要

このワークフローの完了後、概要を提示します。

## Game Test Framework Scaffold Complete

**Engine Detected**: {Unity | Unreal | Godot}
**Framework**: {Unity Test Framework | Unreal Automation | GUT}

**Artifacts Created**:

- Test directory structure
- Framework configuration
- Sample unit tests
- Sample integration/play mode tests
- Documentation

**Next Steps**:

1. Review sample tests and adapt to your game
2. Run initial tests to verify setup
3. Use `test-design` workflow to plan comprehensive test coverage
4. Use `automate` workflow to generate additional tests

**Knowledge Base References Applied**:

- {engine}-testing.md
- qa-automation.md
- test-priorities.md

検証

包括的な検証基準については、checklist.md を参照してください。

完了時

実行:uv run {project-root}/_bmad/scripts/resolve_customization.py --skill {skill-root} --project-root {project-root} --key workflow.on_complete

解決された workflow.on_complete が空でない場合は、終了する前の最後のターミナル指示として従ってください。

コメント