360 Secure SkillHub
360 安全技能中心

Tests Generator

核心功能为生成确定性的单元、集成或E2E测试,确保测试稳定无波动。典型场景:新增功能需测试覆盖、Bug修复需回归测试、重构前需特征测试。输入需指定测试目标,可选测试类型、框架、约束条件;输出为测试文件、运行指引及fixture/mock说明,默认不依赖真实凭据或外部服务。

mzfshark
mzfshark
热度 34.61
最近更新 2026-05-11 17:45:41
分类:开发依赖:代码执行 / 读写文件 / 内部调用大模型应用场景:代码生成 / 调试排错

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add axodus-test-generator
Metadata
name
test-generator
description
Generate deterministic unit/integration tests for critical behaviors.
metadata
{"author":"RedHat Dev","version":"1.0.0","owner":"RedHat Dev Agent","category":"quality"}

SKILL: test-generator

Purpose

Generate deterministic unit/integration tests that protect behavior and enable safe refactors.

When to Use

  • A feature needs coverage.
  • A bug fix needs a regression test.
  • You want characterization tests before refactoring.

Inputs

  • target (required, string): function/module/endpoint/contract behavior to test.
  • test_type (optional, enum: unit|integration|e2e).
  • framework (optional, string): e.g., pytest, jest, vitest, foundry, hardhat.
  • constraints (optional, string[]): no network, deterministic time, limited mocks, etc.

Steps

  1. Identify observable behaviors and edge cases.
  2. Decide test boundaries:
    • unit: pure logic
    • integration: DB/service boundary
  3. Create fixtures:
    • deterministic data
    • stable clocks/UUIDs (mock only when required)
  4. Write tests:
    • happy path
    • failure paths
    • security/validation checks (where applicable)
  5. Run tests and iterate until they are stable.

Validation

  • Tests are deterministic (no flaky time/network dependencies).
  • Tests fail before the fix (for regressions) and pass after.
  • Coverage targets the acceptance criteria, not implementation details.

Output

  • Test files added/changed
  • How to run tests
  • Notes on fixtures/mocks used

Safety Rules

  • Do not add tests that require real credentials or real external services by default.
  • Avoid snapshot tests for highly variable outputs unless stabilized.

Example

Bug: “User creation accepts invalid email.” Output: a failing test asserting 400 on invalid input, then passes after fix.