Testing Standards

Standardize Python test organization with a 3-layer testing pyramid.

Updated Sep 8, 2025
One-click install
npx skills add https://github.com/randalmurphal/claude-config --skill testing-standards-randalmurphal
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Testing Standards
Source: https://github.com/randalmurphal/claude-config/tree/main/skills/testing-standards
Command: npx skills add https://github.com/randalmurphal/claude-config --skill testing-standards-randalmurphal

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Write tests following 3-layer pyramid (unit 95%, integration 85%, E2E critical paths) with 1:1 file mapping for unit tests. Covers test organization, coverage requirements, fixtures, and best practices. Use when writing tests, checking coverage, or validating test structure.

Core Features & Use Cases

  • 3-Layer Pyramid: Clear distribution of unit/integration/e2e tests.
  • 1:1 Mapping: One test file per production file.
  • Fixtures & Best Practices: Guidance on fixtures and test organization.

Quick Start

Start with unit tests mapped 1:1 to production files, then add integration and e2e tests as needed.

Frequently Asked Questions about Testing Standards

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure Python tests using the testing pyramid?

The 3-layer testing pyramid distributes tests as unit (95%), integration (85%), and E2E (critical paths only). Organize unit tests with 1:1 file mapping to production files, add integration tests for component interactions, and E2E tests for user workflows. This structure ensures fast feedback, realistic coverage, and maintainable test suites.

What's the best way to organize test files and fixtures in pytest?

Create one test file per production file for unit tests, use shared fixtures for common test data and setup, and document test purposes in a reference.md. Organize fixtures by scope (function, module, session) and centralize reusable fixtures in conftest.py to reduce duplication and improve maintainability.

How do I achieve consistent test coverage across a Python project?

Set coverage targets aligned to test layers: 95% for unit tests, 85% for integration tests. Use coverage tools to measure and audit test suites against these benchmarks. Apply 1:1 file mapping and documented standards to ensure consistent coverage and identify untested code paths.

What are the key best practices for writing reliable unit tests?

Write unit tests that are fast, isolated, and map 1:1 to production files. Use fixtures for setup, avoid external dependencies, and keep tests focused on single behaviors. Document test intent and maintain a reference guide to ensure tests remain reliable and maintainable over time.

When should I use integration and E2E tests versus unit tests?

Unit tests verify individual functions in isolation (95% of tests). Use integration tests to validate component interactions and data flows (85% coverage). Reserve E2E tests for critical user workflows and system boundaries. This pyramid approach balances speed, confidence, and maintenance cost.

How do I audit and validate my test suite structure?

Audit test organization against the 3-layer pyramid, verify 1:1 mapping for unit tests, and measure coverage against targets (95% unit, 85% integration). Document standards in reference.md and use automated tools to enforce consistent file structure, fixtures, and coverage thresholds.