jpskill.com
📦 その他 コミュニティ

test-data-generation

Generate realistic, consistent test data using factories, fixtures, and fake data libraries. Use for test data, fixtures, mock data, faker, test builders, and seed data generation.

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

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

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

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

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して test-data-generation.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → test-data-generation フォルダができる
  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
同梱ファイル
6

📖 Skill本文(日本語訳)

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

テストデータ生成

目次

概要

テストデータ生成は、自動テストのために、現実的で一貫性があり、保守しやすいテストデータを作成します。適切に設計されたテストデータは、テストの脆さを軽減し、可読性を向上させ、多様なテストシナリオを簡単に作成できるようにします。

使用場面

  • 結合テスト用のフィクスチャを作成する場合
  • 開発データベース用に偽のデータを生成する場合
  • 複雑な関係を持つテストデータを構築する場合
  • テスト用に現実的なユーザー入力を作成する場合
  • テストデータベースにシードを設定する場合
  • エッジケースと境界値を生成する場合
  • 再利用可能なテストデータファクトリを構築する場合

クイックスタート

最小限の動作例:

// tests/factories/userFactory.js
const { faker } = require("@faker-js/faker");

class UserFactory {
  static build(overrides = {}) {
    return {
      id: faker.string.uuid(),
      email: faker.internet.email(),
      firstName: faker.person.firstName(),
      lastName: faker.person.lastName(),
      age: faker.number.int({ min: 18, max: 80 }),
      phone: faker.phone.number(),
      address: {
        street: faker.location.streetAddress(),
        city: faker.location.city(),
        state: faker.location.state(),
        zip: faker.location.zipCode(),
        country: "USA",
      },
      role: "user",
      isActive: true,
      createdAt: faker.date.past(),
      ...overrides,
    };
  }
// ... (see reference guides for full implementation)

リファレンスガイド

references/ ディレクトリ内の詳細な実装:

ガイド 内容
Factory Pattern for Test Data テストデータのためのファクトリパターン
Builder Pattern for Complex Objects 複雑なオブジェクトのためのビルダーパターン
Fixtures for Integration Tests 結合テストのためのフィクスチャ
Realistic Data Generation 現実的なデータ生成

ベストプラクティス

✅ 実施すべきこと

  • 現実的なデータには faker ライブラリを使用する
  • 一般的なオブジェクトには再利用可能なファクトリを作成する
  • ファクトリをオーバーライドで柔軟にする
  • 必要に応じて一意の値を生成する(メールアドレス、ID)
  • 複雑なオブジェクトの構築にはビルダーを使用する
  • 結合テストのセットアップにはフィクスチャを作成する
  • エッジケース(空文字列、null、境界値)を生成する
  • 可能であればテストデータを決定論的に保つ

❌ 実施すべきでないこと

  • 複数の場所でテストデータをハードコードする
  • テストで本番データを使用する
  • 再現可能なテストのために真にランダムなデータを生成する
  • 過度に複雑なファクトリ階層を作成する
  • データ間の関係と制約を無視する
  • 単純なテストのために大量のデータセットを生成する
  • 生成されたデータのクリーンアップを忘れる
  • すべてのテストで同じテストデータを使用する
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Test Data Generation

Table of Contents

Overview

Test data generation creates realistic, consistent, and maintainable test data for automated testing. Well-designed test data reduces test brittleness, improves readability, and makes it easier to create diverse test scenarios.

When to Use

  • Creating fixtures for integration tests
  • Generating fake data for development databases
  • Building test data with complex relationships
  • Creating realistic user inputs for testing
  • Seeding test databases
  • Generating edge cases and boundary values
  • Building reusable test data factories

Quick Start

Minimal working example:

// tests/factories/userFactory.js
const { faker } = require("@faker-js/faker");

class UserFactory {
  static build(overrides = {}) {
    return {
      id: faker.string.uuid(),
      email: faker.internet.email(),
      firstName: faker.person.firstName(),
      lastName: faker.person.lastName(),
      age: faker.number.int({ min: 18, max: 80 }),
      phone: faker.phone.number(),
      address: {
        street: faker.location.streetAddress(),
        city: faker.location.city(),
        state: faker.location.state(),
        zip: faker.location.zipCode(),
        country: "USA",
      },
      role: "user",
      isActive: true,
      createdAt: faker.date.past(),
      ...overrides,
    };
  }
// ... (see reference guides for full implementation)

Reference Guides

Detailed implementations in the references/ directory:

Guide Contents
Factory Pattern for Test Data Factory Pattern for Test Data
Builder Pattern for Complex Objects Builder Pattern for Complex Objects
Fixtures for Integration Tests Fixtures for Integration Tests
Realistic Data Generation Realistic Data Generation

Best Practices

✅ DO

  • Use faker libraries for realistic data
  • Create reusable factories for common objects
  • Make factories flexible with overrides
  • Generate unique values where needed (emails, IDs)
  • Use builders for complex object construction
  • Create fixtures for integration test setup
  • Generate edge cases (empty strings, nulls, boundaries)
  • Keep test data deterministic when possible

❌ DON'T

  • Hardcode test data in multiple places
  • Use production data in tests
  • Generate truly random data for reproducible tests
  • Create overly complex factory hierarchies
  • Ignore data relationships and constraints
  • Generate massive datasets for simple tests
  • Forget to clean up generated data
  • Use the same test data for all tests

同梱ファイル

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