test-writer_skill
- Python
0
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill enoch-robinson/agent-skill-collection --skill test-writer- SKILL.md1.8 KB
Overview
This skill helps you write high-quality, maintainable tests for Python projects. It guides test strategy across unit, integration, and end-to-end levels, and provides naming, structure, and design patterns to improve coverage and reliability. Use it to produce clear, runnable test cases and reduce regressions.
How this skill works
The skill inspects the target code and recommends test targets and priorities following the testing pyramid: many unit tests, a moderate number of integration tests, and few end-to-end tests. It generates concrete test examples using the Arrange-Act-Assert pattern, suggests mocks where appropriate, and lists edge cases, equivalence classes, and boundary values to cover. It also proposes measurable quality checks like independence, speed, and coverage goals.
When to use it
- Writing new unit tests for core logic
- Designing integration or E2E test suites
- Increasing test coverage to meet quality gates
- Defining test cases for boundary and error conditions
- Deciding what to mock vs what to test directly
Best practices
- Follow the test naming convention: test_<function>_<scenario>_<expectedResult>
- Structure tests with Arrange-Act-Assert for clarity and maintainability
- Prioritize unit tests, supplement with targeted integration and sparse E2E tests
- Mock external services, time, randomness, and slow operations; avoid mocking core logic
- Design tests from equivalence classes and boundary-value analysis
- Aim for independent, repeatable, and fast tests; set realistic coverage thresholds (e.g., >80% for core logic)
Example use cases
- Generate unit tests for a pure function with boundary and error cases
- Create integration tests for service-to-database interactions, mocking external APIs
- Draft E2E scenarios that exercise authentication and critical user flows
- Refactor flaky tests by isolating external dependencies and stabilizing assertions
- Produce a checklist for test quality verification before merging a feature
FAQ
Use the pattern test_<function>_<scenario>_<expectedResult>, adding qualifiers like valid/invalid or edgeCase to clarify intent.
When is it appropriate to mock the database?
Mock the database for unit tests to isolate logic; use a real or in-memory database for integration tests to validate interactions and queries.