| name | testing-automation-expert |
| description | Production-grade testing strategies for robust, maintainable systems. Covers unit/integration/E2E testing, contract testing, accessibility, mutation testing, and CI/CD patterns. Supports Python (pytest) and TypeScript (Jest/Vitest/Playwright). |
| author | George Khananaev |
Testing Automation Expert
Master production-grade testing strategies for Python and TypeScript applications. QA Architect level - design test ecosystems that scale.
When to Use
- Designing test strategies for features/projects
- Setting up pytest, Jest, Vitest, or Playwright
- Improving test coverage and quality
- Contract testing, accessibility, mutation testing
- CI/CD test pipeline optimization
- Test architecture review or refactoring
Triggers
/test-plan - Design test strategy for a feature/project
/fixture-refactor - Optimize test fixture architecture
/e2e-setup - Set up Playwright E2E testing
/test-audit - Review test coverage and quality
/contract-test - Set up Pact contract testing
Reference Files
Load the appropriate reference based on need:
| Category | Framework | Reference |
|---|
| Python | pytest | references/python-pytest.md |
| TypeScript | Jest | references/typescript-jest.md |
| TypeScript | Vitest | references/typescript-vitest.md |
| E2E | Playwright | references/e2e-playwright.md |
| Advanced | Contract/A11y/Mutation | references/specialized-testing.md |
Test Quality Checklists
Pre-Implementation Checklist
Unit Test Checklist
Integration Test Checklist
E2E Test Checklist
Architecture Checklist (Microservices)
Test Maintenance Checklist
Testing Pyramid
/\
/E2E\ Few, slow, high confidence
/-----\
/Integ. \ Some, moderate speed
/---------\
/ Contract \ Service boundaries
/-------------\
/ Unit \ Many, fast, isolated
/------------------\
| Type | Count | Speed | Scope |
|---|
| Unit | 60% | <100ms | Single function |
| Contract | 10% | <1s | Service interface |
| Integration | 20% | <5s | Service + DB |
| E2E | 10% | <30s | Full user flow |
Test Organization
tests/
├── conftest.py / setup.ts # Root fixtures
├── factories/ # Test data factories
│ └── user.factory.ts
├── fixtures/ # Static test data
│ └── users.json
├── unit/ # Fast, isolated
│ ├── services/
│ └── utils/
├── integration/ # DB, external services
│ ├── api/
│ └── repositories/
├── contract/ # Pact consumer/provider
│ ├── consumer/
│ └── provider/
├── e2e/ # Full user flows
│ ├── pages/ # Page objects
│ ├── specs/
│ └── a11y/ # Accessibility tests
└── load/ # k6/Locust scripts
└── api-load.js
Anti-Patterns
| Don't | Do |
|---|
| Test implementation details | Test behavior/contracts |
| Hardcode test data | Use factories/fixtures |
| Share state between tests | Isolate with fixtures |
| Mock everything | Mock at boundaries only |
Use time.sleep() | Use wait_for or time mocking |
| Use SQLite for Postgres tests | Use Testcontainers |
| Write flaky time-based tests | Use time-machine / vi.useFakeTimers() |
| Skip edge cases | Use property-based testing |
| Ignore test failures | Fix or remove immediately |
| One giant conftest.py | Split into modules |
| Integration tests for service contracts | Use Pact contract testing |
| Skip accessibility | Add axe-core to E2E |
| Trust coverage alone | Add mutation testing |
Specialized Testing
Contract Testing (Microservices)
pact = Consumer("UserService").has_pact_with(Provider("AuthService"))
See references/specialized-testing.md for full Pact patterns.
API Fuzzing (FastAPI/OpenAPI)
schemathesis run http://localhost:8000/openapi.json
Auto-generates tests from OpenAPI spec - finds edge cases.
Mutation Testing
mutmut run && mutmut results
npx stryker run
Validates test quality - surviving mutants = gaps.
Accessibility Testing
const results = await new AxeBuilder({ page }).analyze();
expect(results.violations).toEqual([]);
Quick Reference
Python (pytest)
pytest
pytest -m "not slow"
pytest --cov=src --cov-report=html
pytest -n auto
pytest -x --lf
pytest -p randomly
TypeScript (Vitest)
npx vitest
npx vitest run
npx vitest --coverage
npx vitest --ui
Playwright
npx playwright test
npx playwright test --shard=1/4
npx playwright test --debug
npx playwright show-trace trace.zip
Recommended Packages
Python
pip install pytest pytest-asyncio pytest-cov pytest-xdist
pip install pytest-mock pytest-randomly time-machine
pip install syrupy hypothesis dirty-equals
pip install testcontainers[postgres] httpx
pip install schemathesis pact-python mutmut
pip install playwright pytest-playwright axe-playwright-python
pip install locust
TypeScript
npm install -D vitest @vitest/coverage-v8 @vitest/ui
npm install -D jest ts-jest @types/jest
npm install -D supertest @types/supertest @faker-js/faker
npm install -D @testcontainers/postgresql
npm init playwright@latest
npm install -D @axe-core/playwright
npm install -D @pact-foundation/pact
npm install -D @stryker-mutator/core @stryker-mutator/vitest-runner