Unit Test Generation

intermediatetestingMin 32K context

Generates comprehensive unit tests for existing code, covering happy paths, edge cases, error conditions, and boundary values. Follows testing best practices including the test pyramid, DAMP over DRY, and the Arrange-Act-Assert pattern. Adapts to the project's existing test framework and conventions.

Use Cases

  • Generating tests for untested legacy code
  • Achieving coverage targets for CI gates
  • TDD red-green-refactor workflow
  • Regression test creation after bug fixes
  • Testing edge cases and error paths

Example Prompt

Generate comprehensive unit tests for the following function.
Include tests for:
- Happy path with typical inputs
- Edge cases (empty inputs, null values, boundary values)
- Error conditions and exception handling
- Type coercion or unexpected input types

Use the project's existing test framework. Follow Arrange-Act-Assert pattern.
Each test should have a descriptive name explaining what it verifies.

Function to test:
```
[paste function here]
```

Recommended Models

Compatible Tools

claude-codecursorgithub-copilotkiroany

Modalities

Input: code, text
Output: code, text

Related Skills

Author

OpenModels Community

@openmodelsrun