test-data-management
Designs test data: builders with valid defaults, unique keys for each test, seeded reference data, synthetic data, masking of personal data and cleanup. Use when the user says 'test data', 'fixtures', 'factories' or 'our tests share data'. Not for environments and containers (use test-environments).
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-14
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- test-data-management
- license
- Apache-2.0
- description
- Designs test data: builders with valid defaults, unique keys for each test, seeded reference data, synthetic data, masking of personal data and cleanup. Use when the user says 'test data', 'fixtures', 'factories' or 'our tests share data'. Not for environments and containers (use test-environments).
- argument-hint
- [domain objects, test suite or environment]
02 资源文件 3
- 参考文档references/java.md1.5 KB
- 参考文档references/python.md1.1 KB
- 参考文档references/typescript.md1.1 KB
03 SKILL.md 正文
test-data-management
Objective
Shared or hand-made test data is a top cause of flaky and unreadable tests. Good test data is created by each test, is valid by default, shows only the values that matter for the case, and does not contain real personal data. This skill sets up such data.
Context
- Read
.agents/qa-project-context.mdif it exists. Use its test data approach, environments and data stores. - If it does not exist, find the current approach in the tests (fixtures, factories, seed scripts). Suggest
qa-project-contextonce. Do not stop the work for it.
Discovery questions
- How do tests get data today: shared seed data, fixtures, factories, copies of production?
- Which reference data must exist (countries, currencies, products, roles)?
- Which data is personal or secret? Which rules apply to it (privacy law, company policy)?
- Do tests run in parallel, and against shared environments?
Principles
- Each test creates its own data, with unique keys. It does not depend on data from another test.
- Valid by default, explicit for the case. A builder fills all required fields with valid values. The test sets only the values that matter, so the reader sees them.
- Create through the fastest trusted path: the API for the end-to-end and API tests, the repository or the database for integration tests, plain objects for unit tests.
- Reference data is seeded and read-only. Tests do not change it.
- No real personal data. Use synthetic data. If production data is needed for a migration or a volume test, mask it first, and follow the data policy.
- Clean up, or isolate. Delete what the test created, or use a fresh schema, tenant or namespace.
Workflow
- List the domain objects that tests need, with their required fields, rules and relations.
- Write a builder or factory for each one, with valid defaults and unique keys (a counter or a random value with a fixed seed).
- Add named variants for the common states ("a paid order", "a locked user").
- Seed the reference data once for each environment, and make it read-only for tests.
- Replace shared or fixed data in the existing tests, starting with the flaky ones.
- Add cleanup or isolation, and run the tests in parallel and in random order to prove it.
- For volume and performance tests, generate the data with a script and a fixed seed.
Stack recipes
Read only the recipe for the stack of the project: Java, TypeScript and JavaScript, Python. For another stack, apply the principles with the project's own tools, and say so.
Anti-patterns
- The "golden" shared data set that all tests change.
- Fixed IDs and emails that collide in parallel runs.
- Copies of production with real names, emails and payment data.
- Builders with random values for every field. Failures do not repeat. Use a seed, and log it.
- Mystery data: the test does not show which values matter.
Done when
- Each domain object in scope has a builder or factory with valid defaults and unique keys.
- Tests create their own data and pass in parallel and in random order.
- Reference data is seeded and not changed by tests.
- No real personal data is in the test data, and any masked data follows the policy.
Related skills
test-environments: where the data lives.database-testingandapi-testing: the paths to create data.flaky-test-detective: data collisions as a cause of flakiness.edge-case-hunter: the edge values to add as variants.
04 同仓库更多 Skills
unit-testing
Writes, fixes or improves unit tests for rules, calculations, validation and state logic: arrange-act-assert, exact oracles, boundary sets, doubles only at boundaries, controlled clock and randomness. Use when the user says 'write unit tests', 'TDD this' or 'mock this dependency'. Not for HTTP endpoints (use api-testing).
ui-automation
Writes, fixes or structures browser end-to-end tests for critical journeys: role, label or test ID locators, auto-waiting assertions, API data setup, page objects, auth reuse and traces. Use when the user says 'UI test', 'end-to-end test' or 'our UI tests are brittle'. Not for business rules (use unit-testing).
testcase-reviewer
Reviews automated tests or manual test cases like a senior test architect: scores fidelity, oracles, assertion depth, edge cases and determinism, and finds tests that pass on wrong code. Use when the user says 'review my tests', 'test smells' or 'review AI-written tests'. Not for fault injection (use mutation-probe).
testability-review
Scores how testable a feature, module or design is before tests exist (seams for clock, randomness and network, hidden state, observability) and gives the smallest production change per blocker. Use when the user asks 'is this testable' or 'why is this hard to test'. Not for writing the tests (use unit-testing).
test-strategy
Writes a test strategy for a product, system or team: quality goals, test levels and their share, environments, data, automation scope, non-functional testing, metrics and a roadmap. Use when the user says 'test strategy' or 'QA strategy'. Not for one sprint or release plan (use test-planning).
test-runner
Finds how a project runs its tests, runs the right subset, and triages each failure as product bug, test defect, environment problem or flaky test, with evidence. Use when the user says 'run the tests' or asks 'which tests fail and why'. Not for pipeline design (use ci-cd-integration).