スキル一覧に戻る
haru01

testing-strategy

by haru01

履修ー出席管理で、C#でDDD(CQRS)をAgentic Coding学習教材

0🍴 0📅 2026年1月2日
GitHubで見るManusで実行

SKILL.md


name: testing-strategy description: Generate tests following project conventions. Use when writing unit tests, integration tests, creating test fixtures, or implementing test builders. Triggers on requests like "write tests for", "add test coverage", "create test builder", "test this handler", or "implement tests".

Testing Strategy

Generate and maintain tests following project-specific conventions for this .NET/EF Core DDD codebase.

Quick Reference

Test Pyramid

        +-------------+
        |  App Layer  |  Primary: Integration tests with SQLite in-memory
        |  Handlers   |  IAsyncLifetime pattern for isolation
        +-------------+
        |  Domain     |  Secondary: Unit tests for complex logic only
        |  Logic      |  Skip simple getters/setters
        +-------------+

Key Decisions

  • NO E2E tests - Application layer integration tests provide sufficient coverage
  • SQLite in-memory - Not EF Core InMemory provider (real constraints matter)
  • IAsyncLifetime - Each test method gets fresh DB instance
  • Builder pattern - Fluent builders with sensible defaults
  • Japanese test names - Describe behavior clearly

Test Implementation Guide

Step 1: Determine Test Type

LayerTest TypeWhen to Test
Application (CommandHandler)IntegrationAlways
Application (QueryHandler)IntegrationAlways
Domain (Aggregate)UnitComplex state transitions only
Domain (Service)UnitComplex business rules only
InfrastructureSkipCovered by Application tests

Step 2: Create Test Class

See references/patterns.md for complete templates:

  • Application Layer: IAsyncLifetime pattern with SQLite
  • Domain Layer: Simple unit test class

Step 3: Use Builders for Test Data

See references/builders.md for all available builders.

Key rules:

  • Single entity: use defaults
  • Multiple entities: MUST specify unique IDs

Step 4: Write Test Methods

See references/examples.md for common scenarios:

  • CommandHandler tests
  • QueryHandler with related data
  • Domain state transitions
  • Exception testing

Resources

FileContent
patterns.mdTemplates, builders, examples, anti-patterns
packages.mdNuGet packages and xUnit config

Anti-Patterns Summary

Anti-PatternCorrect Approach
Shared DbContextIAsyncLifetime with fresh DB
Constructor initInitializeAsync per test
Default IDs for multiple entitiesExplicit ID per entity
Testing simple gettersOnly test complex logic
E2E testsApplication layer integration

スコア

総合スコア

40/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

レビュー

💬

レビュー機能は近日公開予定です