test-data-factory

Generate type-safe test data factories with overridable fields and entity relationships.

28|3|Updated Mar 7, 2026
One-click install
npx skills add https://github.com/girijashankarj/cursor-handbook --skill test-data-factory-girijashankarj
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-data-factory
Source: https://github.com/girijashankarj/cursor-handbook/tree/main/.cursor/skills/testing/test-data-factory
Command: npx skills add https://github.com/girijashankarj/cursor-handbook --skill test-data-factory-girijashankarj

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Developers spend time writing repetitive, hard-to-maintain test data. This Skill provides reusable, type-safe factory functions with sensible defaults and easy overrides to streamline unit and integration tests.

Core Features & Use Cases

  • Factory structure: Establish a consistent layout for entity factories (helpers, index exports, and per-entity factories) to promote reuse.
  • Type-safe defaults: Generate valid objects by default, with overridable fields to tailor test scenarios.
  • Entity relationships & fixtures: Build related entities and preparation utilities (db fixtures) for realistic integration tests.
  • Scenarios & utilities: Include pre-built scenario creators (e.g., admin users, seeded data) and helper utilities for deterministic data.

Quick Start

Create factories for your entities using the provided buildX functions and export them via an index for easy import.

Frequently Asked Questions about test-data-factory

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create type-safe test data factories in TypeScript?

To create type-safe test data factories, generate factory functions with valid default objects and overridable fields, establishing a consistent layout with per-entity factories, helpers, and index exports for easy reuse.

What is the best way to mock related entities for integration tests?

The best way to mock related entities is using factory functions that build related entities and database fixtures, providing realistic, predictable mock data with relationships for integration tests.

Can I override default fields in TypeScript test mocks?

Yes, you can override default fields in TypeScript test mocks by passing specific values to the factory functions, allowing you to tailor valid default objects for specific test scenarios.

How do I generate deterministic test scenarios for unit testing?

Generate deterministic test scenarios by using pre-built scenario creators and helper utilities, providing seeded data like admin users to ensure predictable and reproducible unit testing outcomes.

Does this approach prevent real PII from entering test fixtures?

Yes, generating test data factories prevents real PII from entering test fixtures by creating valid, synthetic mock objects with sensible defaults instead of using sensitive production data.