jpskill.com
🛠️ 開発・MCP コミュニティ

testing-strategies

テスト設計、カバレッジ、プロパティベース、ミューテーション、コントラクト、カオスエンジニアリングなど、高度なテスト戦略と手法を提案するSkill。

📜 元の英語説明(参考)

Advanced testing strategies and methodologies. Use when user asks to "design tests", "test coverage", "property-based testing", "mutation testing", "contract testing", "chaos engineering", "test pyramid", "testing strategy", "behavior-driven development", "acceptance testing", or mentions comprehensive testing approaches.

🇯🇵 日本人クリエイター向け解説

一言でいうと

テスト設計、カバレッジ、プロパティベース、ミューテーション、コントラクト、カオスエンジニアリングなど、高度なテスト戦略と手法を提案するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o testing-strategies.zip https://jpskill.com/download/6136.zip && unzip -o testing-strategies.zip && rm testing-strategies.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/6136.zip -OutFile "$d\testing-strategies.zip"; Expand-Archive "$d\testing-strategies.zip" -DestinationPath $d -Force; ri "$d\testing-strategies.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して testing-strategies.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → testing-strategies フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-17
取得日時
2026-05-17
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

[Skill 名] testing-strategies

テスト戦略と手法

信頼性が高く、高品質なソフトウェアシステムを構築するための包括的なテスト戦略です。

テストピラミッド

        UI/E2E Tests
       /            \
      /              \
   Integration Tests
    /                \
  /                  \
Unit Tests
  • Unit Tests: 高速、独立、低レベル (60%)
  • Integration Tests: コンポーネント間の相互作用 (30%)
  • E2E Tests: システム全体のワークフロー (10%)

テストの種類

単体テスト (Unit Testing)

  • 個々の関数/メソッドをテストします。
  • 依存関係をモックします。
  • 実行が高速です。
  • 例: Jest, Pytest, Mocha

結合テスト (Integration Testing)

  • コンポーネント間の相互作用をテストします。
  • 実際のデータベース/サービスを使用します。
  • 単体テストよりも低速です。
  • 例: Postman, Supertest

エンドツーエンドテスト (End-to-End Testing)

  • 完全なユーザーワークフローをテストします。
  • ブラウザの自動化を行います。
  • 最も低速ですが、最も現実的です。
  • 例: Cypress, Selenium, Playwright

プロパティベーステスト (Property-Based Testing)

  • ランダムな入力を生成します。
  • 不変条件が保持されることを検証します。
  • エッジケースを発見します。
  • 例: Hypothesis, QuickCheck

契約テスト (Contract Testing)

  • サービス間のAPI契約を検証します。
  • コンシューマー側とプロバイダー側があります。
  • マイクロサービスのテストです。
  • 例: Pact, Spring Cloud Contract

カオスエンジニアリング (Chaos Engineering)

  • 意図的に障害を注入します。
  • システムの回復力をテストします。
  • 弱点を発見します。
  • ツール: Chaos Toolkit, Gremlin

ベストプラクティス

  1. 実装ではなく振る舞いをテストする - 「何を」テストするかに焦点を当て、「どのように」テストするかではありません。
  2. テストを高速に保つ - 頻繁に実行します。
  3. 依存関係を分離する - 外部システムをモックします。
  4. 明確なテスト名 - 何がテストされているかを記述します。
  5. DRY テスト - 重複を排除します。
  6. エッジケースをテストする - 境界、null、エラーをテストします。
  7. テストフィクスチャを使用する - 一貫したセットアップを行います。
  8. テストを自動化する - CI/CD と統合します。

テスト命名規則

test_[function]_[scenario]_[expected_outcome]

Example:
test_calculateDiscount_withValidCode_returnsDiscountedPrice
test_loginUser_withInvalidPassword_throwsAuthenticationError

テストパターンの例

AAA パターン (Arrange-Act-Assert)

test('calculateTotal with items', () => {
  // Arrange
  const cart = new Cart();
  cart.addItem({ price: 10 }, 2);

  // Act
  const total = cart.getTotal();

  // Assert
  expect(total).toBe(20);
});

BDD (Behavior-Driven Development)

Feature: User Authentication
  Scenario: Login with valid credentials
    Given a user with email "test@example.com"
    When the user logs in with correct password
    Then they should see the dashboard

メトリクス

  • コードカバレッジ: テストによって実行されたコードの割合 (80%以上を目指します)
  • テスト合格率: 合格したテストの割合
  • テスト実行時間: テストの実行にかかる時間
  • ミューテーションスコア: 導入されたバグのうち、テストによって検出された割合

避けるべき一般的な落とし穴

  • 些細なコードの過剰なテスト
  • エラーパスのテスト不足
  • 不安定なテスト (非決定論的)
  • 実装の詳細のテスト
  • テストにおけるパフォーマンスの無視
  • 並行処理のテスト不足

参考文献

  • Test Driven Development (Kent Beck)
  • Growing Object-Oriented Software, Guided by Tests
  • Working Effectively with Legacy Code (Michael Feathers)
  • Testing Strategies for Microservices
  • Chaos Engineering (whitepaper)
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Testing Strategies & Methodologies

Comprehensive testing strategies for building reliable, high-quality software systems.

Test Pyramid

        UI/E2E Tests
       /            \
      /              \
   Integration Tests
    /                \
  /                  \
Unit Tests
  • Unit Tests: Fast, isolated, low-level (60%)
  • Integration Tests: Component interactions (30%)
  • E2E Tests: Full system workflows (10%)

Testing Types

Unit Testing

  • Test individual functions/methods
  • Mocking dependencies
  • Fast execution
  • Examples: Jest, Pytest, Mocha

Integration Testing

  • Test component interactions
  • With real databases/services
  • Slower than unit tests
  • Examples: Postman, Supertest

End-to-End Testing

  • Complete user workflows
  • Browser automation
  • Slowest but most realistic
  • Examples: Cypress, Selenium, Playwright

Property-Based Testing

  • Generate random inputs
  • Verify invariants hold
  • Find edge cases
  • Examples: Hypothesis, QuickCheck

Contract Testing

  • Verify API contracts between services
  • Consumer and provider sides
  • Microservices testing
  • Examples: Pact, Spring Cloud Contract

Chaos Engineering

  • Inject failures intentionally
  • Test system resilience
  • Find weak points
  • Tools: Chaos Toolkit, Gremlin

Best Practices

  1. Test Behavior, Not Implementation - Focus on what, not how
  2. Keep Tests Fast - Run frequently
  3. Isolate Dependencies - Mock external systems
  4. Clear Test Names - Describe what's being tested
  5. DRY Tests - Eliminate duplication
  6. Test Edge Cases - Boundaries, nulls, errors
  7. Use Test Fixtures - Consistent setup
  8. Automate Testing - CI/CD integration

Test Naming Convention

test_[function]_[scenario]_[expected_outcome]

Example:
test_calculateDiscount_withValidCode_returnsDiscountedPrice
test_loginUser_withInvalidPassword_throwsAuthenticationError

Example Test Patterns

AAA Pattern (Arrange-Act-Assert)

test('calculateTotal with items', () => {
  // Arrange
  const cart = new Cart();
  cart.addItem({ price: 10 }, 2);

  // Act
  const total = cart.getTotal();

  // Assert
  expect(total).toBe(20);
});

BDD (Behavior-Driven Development)

Feature: User Authentication
  Scenario: Login with valid credentials
    Given a user with email "test@example.com"
    When the user logs in with correct password
    Then they should see the dashboard

Metrics

  • Code Coverage: % of code executed by tests (aim for 80%+)
  • Test Pass Rate: % of tests passing
  • Test Execution Time: How long tests take to run
  • Mutation Score: % of introduced bugs caught

Common Pitfalls to Avoid

  • Over-testing trivial code
  • Not testing error paths
  • Flaky tests (non-deterministic)
  • Testing implementation details
  • Ignoring performance in tests
  • Not testing concurrency

References

  • Test Driven Development (Kent Beck)
  • Growing Object-Oriented Software, Guided by Tests
  • Working Effectively with Legacy Code (Michael Feathers)
  • Testing Strategies for Microservices
  • Chaos Engineering (whitepaper)