Test Data Management
// Definition
Provisioning, masking, refreshing, and tearing down data needed by tests. Done well, it's invisible. Done badly, it's the reason a third of tests fail on Mondays.
// Code Example
import { faker } from '@faker-js/faker';
type User = { id: string; email: string; role: 'admin' | 'user' };
const buildUser = (overrides: Partial<User> = {}): User => ({
id: faker.string.uuid(),
email: faker.internet.email(),
role: 'user',
...overrides,
});
// Defaults for most tests
const user = buildUser();
// Override only what matters for this case
const admin = buildUser({ role: 'admin', email: 'admin@example.com' });// Related terms
Test Fixture
A known, fixed state used as a baseline for tests — sample data, a seeded database, or a configured environment that ensures repeatability across runs.
Test Environment
The infrastructure where tests run — hardware, OS, database, network, and configuration. Differences between test and production are a leading source of bugs that pass tests but fail in production.
Data-Driven Testing
Running the same test logic against many input/output combinations, typically loaded from a CSV, JSON file, or database. Separates test data from test code so you can scale coverage without duplicating logic.
Learn more · Git for QA
Chapter 5 · Lesson 2: Managing Test Data and Fixtures in Git