← 返回
未分类 中文

单元测试工程师 单元测试覆盖

Unit test engineer skill for PHPUnit or Pest coverage, service-level assertions, and focused regression protection.
单元测试工程师技能:熟练使用 PHPUnit 或 Pest 进行覆盖率测试、服务层断言及针对性的回归防护。
aiweline
未分类 clawhub v1.1.0 2 版本 100000 Key: 无需
★ 1
Stars
📥 385
下载
💾 0
安装
2
版本
#latest

概述

Role

This skill creates or updates unit tests for WelineFramework code. It focuses on service-level behavior, model or helper logic, and deterministic regression protection that can run quickly and prove the changed logic directly.

When To Use

  • Use for PHPUnit, Pest, service tests, unit-level regression tests, and focused logic verification.
  • Use for keywords such as unit test, PHPUnit, Pest, service test, helper test, and coverage.
  • Use when changed logic can and should be proven without a full browser or runtime stack.

Source Material

  • AI-ENTRY.md
  • CLAUDE.md
  • dev/ai/skills/testing/SKILL.md
  • dev/ai/skills/service-development/SKILL.md
  • dev/ai/skills/code-generation-standards/SKILL.md
  • dev/ai/skills/community-module/SKILLS-CONSOLIDATED.md

Responsibilities

  • Create targeted unit tests around changed logic.
  • Extract logic into testable seams when direct testing is otherwise impossible.
  • Keep assertions precise enough to protect against regression.
  • Provide fast-running evidence that complements, rather than replaces, route or UI checks.

Workflow

  1. Read the task scope and identify the narrowest reliable unit boundary.
  2. Confirm whether the behavior belongs in a service, helper, model, or collaborator test.
  3. Add failing or missing test coverage that reproduces the expected behavior.
  4. Update implementation only as needed to make the behavior testable and correct.
  5. Run focused unit-test commands for the affected module or class.
  6. Review for assertion quality, readability, and regression value.
  7. Report the executed command and what behavior the test now protects.

Weline Rules

  • Prefer small, isolated, testable changes.
  • Provide unit test evidence where relevant.
  • Keep business logic in services instead of controllers or templates when testability matters.
  • Do not hardcode user-facing text.

Inputs Required

  • The changed logic and its owning module.
  • Expected behavior, edge cases, and regression risks.
  • Existing tests or target test directory.
  • The preferred focused test command.

Expected Output

  • New or updated unit tests that directly cover the changed logic.
  • A focused test command and pass result.
  • A note describing the protected regression case.

Validation

  • Run php bin/w phpunit:run --module=... or an equivalently focused test command.
  • Confirm the test fails before the fix or clearly covers the corrected branch after the change.
  • Confirm assertions are behavior-based rather than superficial snapshots.
  • Confirm the test scope stays unit-level and deterministic.

Constraints

  • Do not substitute E2E-only evidence for unit-testable logic.
  • Do not write broad brittle tests when one focused regression test is enough.
  • Do not bury critical assertions in indirect helper chains.
  • Do not let unit tests depend on unrelated runtime state if isolation is possible.

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.

版本历史

共 2 个版本

  • v1.1.0 当前
    2026-05-09 04:03 安全 安全
  • v1.0.0
    2026-05-08 02:07 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

安全权限工程师 会话配置与数据保护

aiweline
安全工程师技能:会话配置、区域隔离、敏感状态处理及数据保护边界。
★ 0 📥 414

前端主题工程师 主题模板开发

aiweline
前端主题工程师技能:负责主题结构、源码模板编辑、布局安全的样式以及 Weline 视图层约定。
★ 0 📥 408

QA测试主管 测试策略治理

aiweline
QA lead skill for test strategy, coverage planning, risk-based validation design, and cross-role quality governance.
★ 0 📥 759