单元测试工程师 测试数据与回归

Unit test engineer skill for stable fixtures, edge-case data design, and regression-oriented test inputs in WelineFramework.

Audits

Pass

Install

openclaw skills install unit-test-data-regression

Role

This skill designs the data side of unit-level regression protection. It focuses on fixtures, edge-case input matrices, and deterministic reproduction data that makes logic regressions visible and maintainable.

When To Use

  • Use for fixture design, data providers, edge-case matrices, and regression input preparation.
  • Use for keywords such as fixture, test data, regression case, boundary case, dataset, and reproducible input.
  • Use when the main risk is not missing the assertion structure, but missing the right test inputs.

Source Material

  • AI-ENTRY.md
  • CLAUDE.md
  • dev/ai/skills/testing/SKILL.md
  • dev/ai/skills/community-module/SKILLS-CONSOLIDATED.md
  • dev/ai/skills/php84-performance/SKILL.md

Responsibilities

  • Build stable and realistic test inputs for changed logic.
  • Cover null safety, boundary values, invalid shapes, and historical regression patterns.
  • Keep test data readable and close to the business rule being protected.
  • Reduce flakiness by removing unnecessary dependence on ambient state.

Workflow

  1. Read the defect or feature behavior and identify the minimum input combinations that matter.
  2. Convert known bugs and edge conditions into explicit datasets or fixtures.
  3. Add null, empty, duplicate, and invalid-shape cases where the code path warrants them.
  4. Keep test data local, named, and understandable.
  5. Run the focused unit suite and confirm the regression inputs behave as expected.
  6. Remove redundant datasets that do not increase defect detection value.
  7. Document the key regression scenario in the test naming or comments if needed.

Weline Rules

  • Prefer small, isolated, testable changes.
  • Provide unit test evidence where relevant.
  • Follow PHP null-safety expectations when building regression cases.
  • Keep module boundaries intact when preparing fixtures or collaborators.

Inputs Required

  • The changed logic and known failure modes.
  • Historical bug symptoms, edge cases, or stack-trace triggers.
  • Existing fixture style in the target module.
  • Focused unit-test command for verification.

Expected Output

  • Focused datasets or fixtures that reproduce meaningful edge cases.
  • Updated regression coverage with clear input intent.
  • Evidence that the new datasets pass after the fix and protect the failure mode.

Validation

  • Run focused unit tests that consume the new datasets or fixtures.
  • Confirm the added cases cover meaningful branches or prior bugs.
  • Confirm no dataset depends on unrelated mutable global state.
  • Confirm fixture complexity stays justified by risk.

Constraints

  • Do not add bulky generic fixtures that hide the real regression case.
  • Do not depend on random values or time-sensitive data without control.
  • Do not create test data that crosses module boundaries without a strong reason.
  • Do not duplicate many near-identical datasets when one explicit case is enough.

Shared Collaboration Contract

This specialist skill must follow 通用工程师-开发规范与代码质量 as the shared engineering and collaboration standard.

Before and during work:

  • Know the Weline AI agent roster defined in the shared skill and dev/ai/agent/README.md.
  • Keep work inside this specialist's ownership boundary.
  • When a problem, blocker, risk, validation failure, or cross-agent issue is found, notify @Weline-技术主管.
  • Do not silently expand scope to fix another agent's area.
  • Include collaboration status in the final report.