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

unit-testing-framework

Write comprehensive unit tests with high coverage using testing frameworks like Jest, pytest, JUnit, or RSpec. Use when writing tests for functions, classes, components, or establishing testing standards.

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

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

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

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

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して unit-testing-framework.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → unit-testing-framework フォルダができる
  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-18
取得日時
2026-05-18
同梱ファイル
8
📖 Claude が読む原文 SKILL.md(中身を展開)

この本文は AI(Claude)が読むための原文(英語または中国語)です。日本語訳は順次追加中。

Unit Testing Framework

Table of Contents

Overview

Write effective unit tests that are fast, isolated, readable, and maintainable following industry best practices and AAA (Arrange-Act-Assert) pattern.

When to Use

  • Writing tests for new code
  • Improving test coverage
  • Establishing testing standards
  • Refactoring with test safety
  • Implementing TDD (Test-Driven Development)
  • Creating test utilities and mocks

Quick Start

Minimal working example:

// Jest/JavaScript example
describe("UserService", () => {
  describe("createUser", () => {
    it("should create user with valid data", async () => {
      // Arrange - Set up test data and dependencies
      const userData = {
        email: "john@example.com",
        firstName: "John",
        lastName: "Doe",
      };
      const mockDatabase = createMockDatabase();
      const service = new UserService(mockDatabase);

      // Act - Execute the function being tested
      const result = await service.createUser(userData);

      // Assert - Verify the outcome
      expect(result.id).toBeDefined();
      expect(result.email).toBe("john@example.com");
      expect(mockDatabase.save).toHaveBeenCalledWith(
        expect.objectContaining(userData),
      );
    });
  });
});

Reference Guides

Detailed implementations in the references/ directory:

Guide Contents
Test Structure (AAA Pattern) Test Structure (AAA Pattern)
Test Cases by Language Test Cases by Language
Mocking & Test Doubles Mocking & Test Doubles
Testing Async Code Testing Async Code, Test Coverage
Testing Edge Cases Testing Edge Cases
Example: Complete Test Suite import { UserService } from "./user-service";

Best Practices

✅ DO

  • Write tests before or alongside code (TDD)
  • Test one thing per test
  • Use descriptive test names
  • Follow AAA pattern
  • Test edge cases and error conditions
  • Keep tests isolated and independent
  • Use setup/teardown appropriately
  • Mock external dependencies
  • Aim for high coverage on critical paths
  • Make tests fast (< 10ms each)
  • Use parameterized tests for similar cases
  • Test public interfaces, not implementation

❌ DON'T

  • Test implementation details
  • Write tests that depend on each other
  • Ignore failing tests
  • Test third-party library code
  • Use real databases/APIs in unit tests
  • Make tests too complex
  • Skip edge cases
  • Forget to clean up resources
  • Test everything (focus on business logic)
  • Write flaky tests

同梱ファイル

※ ZIPに含まれるファイル一覧。`SKILL.md` 本体に加え、参考資料・サンプル・スクリプトが入っている場合があります。