AgentSkillsCN

Test Generator

测试生成器

SKILL.md

Test Generator

Generate comprehensive tests for the selected code or file.

Test Requirements

  1. Test Framework

    • Go: Use testing package, testify for assertions
    • Java: Use JUnit 5
    • C++: Use Google Test or Catch2
  2. Coverage

    • Test happy path scenarios
    • Test edge cases and boundary conditions
    • Test error conditions
    • Test concurrent scenarios if applicable
  3. Test Structure

    • Use table-driven tests for Go
    • Use meaningful test names (e.g., TestFunctionName_Scenario_ExpectedBehavior)
    • Group related tests
    • Use setup/teardown where appropriate
  4. Test Quality

    • Tests should be independent and isolated
    • Use mocks/stubs for external dependencies
    • Avoid test interdependencies
    • Make tests deterministic (no random values, no time dependencies)
  5. Documentation

    • Add comments for complex test scenarios
    • Explain what is being tested and why

Output

Generate complete, runnable test code with:

  • Necessary imports
  • Test setup/teardown
  • Multiple test cases covering different scenarios
  • Clear assertions with helpful error messages