From test-data-generator
Generates realistic test data, fixtures, factories, seeds, and edge cases using Faker.js, Fishery, pytest fixtures for JS/TS/Python apps and databases.
npx claudepluginhub jeremylongshore/claude-code-plugins-plus-skills --plugin test-data-generatorThis skill is limited to using the following tools:
Generate realistic, type-safe test data including fixtures, factory functions, seed datasets, and edge case values. Supports Faker.js, Factory Bot patterns, Fishery (TypeScript factories), pytest fixtures, and database seed scripts.
Generates realistic, consistent test data using factories, fixtures, builders, and faker libraries for unit/integration tests, mocks, seeds, and edge cases.
Generates realistic database seed scripts using Faker libraries, respecting foreign keys, constraints, and data types via schema analysis and topological sort. For dev/test environments.
Share bugs, ideas, or general feedback.
Generate realistic, type-safe test data including fixtures, factory functions, seed datasets, and edge case values. Supports Faker.js, Factory Bot patterns, Fishery (TypeScript factories), pytest fixtures, and database seed scripts.
faker.seed())faker.person.fullName() for names, faker.internet.email() for emails).faker.seed(12345)).ON CONFLICT or INSERT IF NOT EXISTS).test/factories/ or tests/factories/| Error | Cause | Solution |
|---|---|---|
| Factory produces invalid data | Schema changed but factory not updated | Add a validation step that runs the factory output through the schema validator |
| Duplicate unique values | Faker generates collisions in small datasets | Use sequential IDs or append a counter; increase Faker's unique retry limit |
| Database seed fails on foreign key | Seed insertion order violates referential integrity | Sort seed operations topologically by dependency; disable FK checks during seeding |
| Factory recursion overflow | Circular relationships (User -> Order -> User) | Limit relationship depth; use lazy references; break cycles with ID-only references |
| Non-deterministic test failures | Random seed not set consistently | Call faker.seed() in beforeAll or at factory module level; document seed values |
TypeScript factory with Fishery:
import { Factory } from 'fishery';
import { faker } from '@faker-js/faker';
interface User {
id: string;
name: string;
email: string;
role: 'admin' | 'user';
createdAt: Date;
}
export const userFactory = Factory.define<User>(({ sequence }) => ({
id: `user-${sequence}`,
name: faker.person.fullName(),
email: faker.internet.email(),
role: 'user',
createdAt: faker.date.past(),
}));
// Usage:
const user = userFactory.build();
const admin = userFactory.build({ role: 'admin' });
const users = userFactory.buildList(10);
pytest fixture factory:
import pytest
from faker import Faker
fake = Faker()
Faker.seed(42)
@pytest.fixture
def make_user():
def _make_user(**overrides):
defaults = {
"name": fake.name(),
"email": fake.email(),
"age": fake.random_int(min=18, max=99),
}
return {**defaults, **overrides}
return _make_user
def test_user_validation(make_user):
user = make_user(age=17)
assert validate_age(user) is False
Edge case data collection:
export const edgeCases = {
strings: ['', ' ', '\t\n', 'a'.repeat(10000), '<script>alert(1)</script>', # 10000: 10 seconds in ms
"Robert'); DROP TABLE users;--", '\u0000null\u0000byte'],
numbers: [0, -0, -1, Number.MAX_SAFE_INTEGER, NaN, Infinity, -Infinity],
dates: [new Date(0), new Date('2024-02-29'), new Date('9999-12-31')], # 2024: 9999 = configured value
};