testing

テストコード作成と品質保証の規約

⭐0stars🔀0forks📁View on GitHub🕐Updated Dec 29, 2025⬇️1downloads

When & Why to Use This Skill

This Claude skill provides a comprehensive framework for test code creation and quality assurance. It establishes standardized coding conventions for testability, mock utilization, and the DRY principle, while offering a detailed checklist for unit testing, integration testing, and code coverage to ensure robust and reliable software development.

Use Cases

  • Standardizing testing practices and quality protocols across a development team to maintain high code quality and consistency.
  • Creating comprehensive unit tests that cover normal paths, error handling, and boundary conditions for complex business logic.
  • Designing testable software architectures by implementing dependency injection and effective mocking strategies for external dependencies.
  • Evaluating test suites against coverage metrics and integration requirements to ensure system-wide stability and prevent regressions.
nametesting
descriptionテストコード作成と品質保証の規約

テストと品質のコーディング規約

  • テスト容易性: テスト容易性を考慮した設計とし、関数は副作用のない構造を基本とする。
  • モック活用: 依存関係は外部注入可能にしてモックを活用できるようにする。
  • DRY 原則: テストにも DRY 原則を適用し、共通処理をフィクスチャなどに集約する。

テスト戦略チェックリスト

  • 単体テスト (Unit Test):
    • 正常系: 期待通りの入力で期待通りの出力が得られるか
    • 異常系: 無効な入力やエラー発生時に適切にハンドリングされるか
    • 境界値: 境界条件(0, 空文字, 最大値など)での動作確認
  • 統合テスト (Integration Test):
    • データベースや外部 API との連携は正しく動作するか(モックを使用する場合もあり)
    • コンポーネント間の連携は正しいか
  • カバレッジ:
    • 分岐網羅(C1)を意識しているか
    • 重要なビジネスロジックは 100%カバーされているか