testing-strategies
Testing Strategies covers the testing pyramid—unit tests for speed and breadth, integration tests for component interaction, and E2E tests for full-system validation. Learn Arrange-Act-Assert structure, mocking patterns, edge case handling, and database testing with real examples using Jest, Playwright, and Testcontainers.
Testing Strategies teaches unit, integration, and E2E testing patterns with practical examples for building reliable software.
AI-generated summary based on this skill's SKILL.md
Install
miles990/claude-software-skills/testing-strategies · repository language: TypeScript
git clone https://github.com/miles990/claude-software-skills
cp -r claude-software-skills/software-engineering/testing-strategies ~/.claude/skills/testing-strategiesnpx skillfed install miles990/claude-software-skills/testing-strategiesFrequently asked questions
AI-generated answers based on this skill's SKILL.md and metadata
What is the testing pyramid and what are best practices?
Testing Strategies explains the testing pyramid as a framework balancing test types: a broad base of fast unit tests, a middle layer of integration tests for component interaction, and a small top of E2E tests for full-system validation. This ratio ensures rapid feedback during development while maintaining comprehensive coverage. The pyramid prioritizes unit tests for speed and breadth, integration tests to verify components work together, and E2E tests using tools like Playwright to validate complete workflows.
How do you write unit tests using the Arrange-Act-Assert pattern?
Testing Strategies teaches the Arrange-Act-Assert (AAA) pattern as the foundation for unit test structure. Arrange sets up test data and mocks; Act executes the code under test; Assert verifies the outcome. This pattern, combined with Jest, creates clear, maintainable tests. Testing Strategies covers how to structure each phase, use test fixtures and factories for setup, and apply mocking to isolate units under test for reliable, focused assertions.
What are the differences between mock, stub, and spy in testing?
Testing Strategies distinguishes these test isolation techniques: mocks replace dependencies and verify interactions were called correctly; stubs provide fixed responses without verification; spies wrap real functions to track calls while preserving behavior. Jest supports all three patterns. Testing Strategies shows when to use each—mocks for behavior verification, stubs for simple return values, and spies for observing real function calls—enabling effective test isolation and preventing flaky tests.
How does Testing Strategies cover E2E and integration testing workflows?
Testing Strategies implements E2E testing with Playwright for full-system validation across browsers, and integration testing to verify component interaction. It covers database testing using Testcontainers for isolated, reproducible environments. Real examples show API testing with Supertest, async code testing in JavaScript, and strategies for comparing tools like Cypress vs Playwright. These workflows validate that units work together and the complete system behaves correctly.
What testing strategies does Testing Strategies recommend for async code?
Testing Strategies addresses testing async JavaScript code by handling promises, callbacks, and async/await patterns in Jest. It covers waiting for async operations to complete, mocking async dependencies, and avoiding flaky tests from race conditions. The skill teaches edge case handling for async scenarios, timeout management, and using test fixtures to set up async state, ensuring reliable tests for modern JavaScript applications.
How can you improve code coverage and write testable code?
Testing Strategies covers code coverage metrics to identify untested paths and guide test writing. It teaches writing testable code by designing functions with clear inputs/outputs, avoiding tight coupling, and using dependency injection for mockability. The skill emphasizes edge case testing, test-driven development (TDD) with the red-green-refactor cycle, and CI/CD automation to catch regressions early, ensuring sustainable test practices.
SKILL.md
rendered from the published skill — quoted content, verbatim
name: testing-strategies description: Unit, integration, E2E testing and TDD practices domain: software-engineering version: 1.0.0 tags: [testing, unit-test, integration-test, e2e, tdd, mocking] triggers: keywords: primary: [test, testing, unit test, integration test, e2e, tdd, jest, pytest] secondary: [mock, stub, fixture, coverage, assertion, cypress, playwright] context_boost: [quality, ci, automation, reliability] context_penalty: [design, architecture, frontend] priority: high collaboration: prerequisites: [] delegation_triggers: - trigger: Backend service to be tested delegate_to: backend context: Service architecture, dependencies - trigger: Frontend component to be tested delegate_to: frontend context: Component props, user interactions - trigger: API contract tests delegate_to: api-design context: API specifications, expected behaviors - trigger: Database fixtures and test data delegate_to: database context: Schema structure, seed data patterns receives_context_from: - skill: backend receives: - Service dependencies to mock - Integration test scenarios
(truncated - see the full file via the links below)
Read as markdown · JSON record · Browse the source repository
File tree — 5 files
software-engineering/testing-strategies/SKILL.md
software-engineering/testing-strategies/templates/README.md
software-engineering/testing-strategies/templates/jest.config.ts
software-engineering/testing-strategies/templates/pytest.ini
software-engineering/testing-strategies/templates/vitest.config.ts