Test Data Generation

Test Data Generation

Generates realistic, consistent test data with factories, builders, fixtures and faker libraries for unit and integration tests and seed databases.

Skill files7 files

references/

scripts/

templates/

SKILL.md100 lines
1
---
2
name: test-data-generation
3
description: >
4
Generate realistic, consistent test data using factories, fixtures, and fake
5
data libraries. Use for test data, fixtures, mock data, faker, test builders,
6
and seed data generation.
7
---
8
9
# Test Data Generation
10
11
## Table of Contents
12
13
- [Overview](#overview)
14
- [When to Use](#when-to-use)
15
- [Quick Start](#quick-start)
16
- [Reference Guides](#reference-guides)
17
- [Best Practices](#best-practices)
18
19
## Overview
20
21
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.
22
23
## When to Use
24
25
- Creating fixtures for integration tests
26
- Generating fake data for development databases
27
- Building test data with complex relationships
28
- Creating realistic user inputs for testing
29
- Seeding test databases
30
- Generating edge cases and boundary values
31
- Building reusable test data factories
32
33
## Quick Start
34
35
Minimal working example:
36
37
```javascript
38
// tests/factories/userFactory.js
39
const { faker } = require("@faker-js/faker");
40
41
class UserFactory {
42
static build(overrides = {}) {
43
return {
44
id: faker.string.uuid(),
45
email: faker.internet.email(),
46
firstName: faker.person.firstName(),
47
lastName: faker.person.lastName(),
48
age: faker.number.int({ min: 18, max: 80 }),
49
phone: faker.phone.number(),
50
address: {
51
street: faker.location.streetAddress(),
52
city: faker.location.city(),
53
state: faker.location.state(),
54
zip: faker.location.zipCode(),
55
country: "USA",
56
},
57
role: "user",
58
isActive: true,
59
createdAt: faker.date.past(),
60
...overrides,
61
};
62
}
63
// ... (see reference guides for full implementation)
64
```
65
66
## Reference Guides
67
68
Detailed implementations in the `references/` directory:
69
70
| Guide | Contents |
71
|---|---|
72
| [Factory Pattern for Test Data](references/factory-pattern-for-test-data.md) | Factory Pattern for Test Data |
73
| [Builder Pattern for Complex Objects](references/builder-pattern-for-complex-objects.md) | Builder Pattern for Complex Objects |
74
| [Fixtures for Integration Tests](references/fixtures-for-integration-tests.md) | Fixtures for Integration Tests |
75
| [Realistic Data Generation](references/realistic-data-generation.md) | Realistic Data Generation |
76
77
## Best Practices
78
79
### ✅ DO
80
81
- Use faker libraries for realistic data
82
- Create reusable factories for common objects
83
- Make factories flexible with overrides
84
- Generate unique values where needed (emails, IDs)
85
- Use builders for complex object construction
86
- Create fixtures for integration test setup
87
- Generate edge cases (empty strings, nulls, boundaries)
88
- Keep test data deterministic when possible
89
90
### ❌ DON'T
91
92
- Hardcode test data in multiple places
93
- Use production data in tests
94
- Generate truly random data for reproducible tests
95
- Create overly complex factory hierarchies
96
- Ignore data relationships and constraints
97
- Generate massive datasets for simple tests
98
- Forget to clean up generated data
99
- Use the same test data for all tests
100

© AJ Geddes · MIT · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 14,621 prompts

More by @OpenSourceBuffGuy

See all
Sea turtle carrying floating film studio island prompt image

Sea turtle carrying floating film studio island

Draws a giant sea turtle carrying a floating island film studio through a starry sky, where fairies polish rough film strips into golden film.

image-prompt, nano-banana, 3d-render, cartoon, fantasy-world, creatures, animals, whimsical, dreamy, cinematic, dramatic-lighting, vibrant-colors, bokeh, miniature, widescreen, night-scene, illustration, concept-art, surreal, storytelling, clay-3d

Desert buggy escapes drones past industrial outpost prompt image

Desert buggy escapes drones past industrial outpost

Builds a 15-second desert chase video where a racer in an armored buggy escapes drones past an industrial outpost, using five reference images with set jobs.

video-prompt, hailuo, action, multi-shot, timed-beats, camera-movement, reference-image, character-consistency, negative-prompt, cinematic, sci-fi, cars, landscape, aerial-view, tracking-shot, photorealistic, sound-effects, structured-output, long-form, widescreen

1 view
Cozy Pixel Art Farm Island Village prompt image

Cozy Pixel Art Farm Island Village

Draws a cozy 16-bit pixel-art farming village across six small islands joined by bridges, with exact counts for buildings, animals and crops.

image-prompt, gpt-image, pixel-art, isometric, game-assets, concept-art, maps, worldbuilding, cozy, vibrant-colors, ocean, landscape, wide-shot, widescreen, game-development, video-games, structured-output, whimsical, summer, high-angle, aerial-view, animals, negative-prompt, cityscape

1 view

Reviews

Loading reviews…

Discussion

Loading comments…