- Home
- Skills
- Georgekhananaev
- Claude Skills Vault
- Test Levels
test-levels_skill
- Python
9
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 georgekhananaev/claude-skills-vault --skill test-levels- SKILL.md6.8 KB
Overview
This skill explains the three test levels—Unit, Integration, and E2E—using a clear "Building a Car" analogy and maps each level to practical guidance. It includes project-specific Playwright examples and a compact decision guide to choose the right test type. The goal is to help teams write the right tests in the right place, faster.
How this skill works
The skill breaks testing into three layers: Unit (isolated functions), Integration (component handshakes), and E2E (full user journeys). For each layer it describes scope, speed, file locations, when to write the tests, and gives Playwright-style examples from the project. It also supplies a test pyramid and commands for running tests locally.
When to use it
- Explaining test concepts to teammates or new hires
- Choosing whether a change needs a unit, integration, or E2E test
- Reviewing or planning test coverage strategy
- Writing tests for validators, API handlers, or UI flows
- Setting up Playwright-based tests for the project
Best practices
- Name tests clearly: should [action] when [condition]
- Keep one assertion focus — test a single behavior per test
- Group related tests with test.describe and use beforeEach/afterEach for setup/teardown
- Mock external dependencies (e.g., mockLoggedUser, resetAPIEndpointsMock) for stable integration tests
- Use data-testid attributes for reliable E2E selectors and set longer timeouts for slow flows
Example use cases
- Unit test a formatter or validator in tests/unit/ (fast, isolated)
- Integration test a Zod validator or API route in tests/integration/ with mocked context
- E2E test a login-to-checkout flow in tests/pages/ using Playwright and test fixtures
- Create smoke E2E checks for critical flows to run on deploy
- Write a small integration test for a DB query using seeded/mock data
FAQ
If you need to verify only the interaction between modules (no browser), pick integration. If you need to validate the full user experience across pages, choose E2E.
Where should I place fast utility tests?
Put pure function tests in tests/unit/ so they run fast and catch logic errors early.