testing-patterns

Guide unit, integration, and E2E testing patterns and best practices.

11|4|Updated Feb 9, 2026
One-click install
npx skills add https://github.com/wpank/ai --skill testing-patterns-wpank
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: testing-patterns
Source: https://github.com/wpank/ai/tree/main/skills/testing/testing-patterns
Command: npx skills add https://github.com/wpank/ai --skill testing-patterns-wpank

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill helps you write effective tests that catch bugs, improve code quality, and provide confidence in your software. It addresses the challenges of creating reliable, maintainable, and fast test suites.

Core Features & Use Cases

  • Testing Strategies: Learn about the testing pyramid and when to use unit, integration, and E2E tests.
  • Test Patterns: Implement common patterns like Arrange-Act-Assert, Given-When-Then, and parameterized tests.
  • Test Doubles: Understand and apply stubs, mocks, spies, and fakes effectively.
  • Integration Testing: Strategies for database and API testing.
  • Mocking Best Practices: Learn to mock at boundaries, not implementations.
  • Use Case: When developing a new feature, use this Skill to guide the creation of a comprehensive test suite that covers unit, integration, and E2E scenarios, ensuring the feature works as expected and preventing regressions.

Quick Start

Use the testing-patterns skill to generate a unit test for the provided function using the Arrange-Act-Assert pattern.

Frequently Asked Questions about testing-patterns

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

FAQPage Schema
What is the difference between unit, integration, and E2E testing?

Unit testing validates individual functions in isolation, integration testing verifies interactions between modules or APIs, and E2E testing evaluates complete user flows. The testing pyramid guides how to balance these levels for a reliable suite.

How do I write a unit test using the Arrange-Act-Assert pattern?

To write a unit test using Arrange-Act-Assert, first set up your required data and dependencies, then execute the function being tested, and finally assert that the output matches your expected results.

When should I use mocks vs stubs vs spies as test doubles?

Use stubs to provide predefined return values, mocks to verify specific interactions between objects, and spies to record method calls while still executing the original implementation. Mocking at boundaries rather than implementations creates more reliable tests.

What is the best way to test database and API integrations?

The best way to test database and API integrations is to apply dedicated integration testing strategies that verify data persistence and external endpoints, ensuring your integration tests interact with real boundaries rather than heavily mocked implementations.

How can I make my test suite catch more bugs and prevent regressions?

To make your test suite catch more bugs, implement a mix of unit, integration, and E2E tests using patterns like Given-When-Then and parameterized tests. Applying test quality checklists ensures your tests remain effective and maintainable.