testing-patterns

Generate unit and integration tests using AAA structure and mocking guidelines.

Updated Dec 15, 2025
One-click install
npx skills add https://github.com/neokn/dotClaude --skill testing-patterns-neokn
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: testing-patterns
Source: https://github.com/neokn/dotClaude/tree/main/skills/testing-patterns
Command: npx skills add https://github.com/neokn/dotClaude --skill testing-patterns-neokn

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps teams write clear, maintainable tests with structured approaches and quality-focused guidelines.

Core Features & Use Cases

  • AAA Pattern: Arrange, Act, Assert for readable tests.
  • Test Quality Checklist: Ensure tests are fast, deterministic, and well-named.
  • Mocking Guidelines: Guidance on when and what to mock to keep tests reliable.

Quick Start

Write a unit test for a pure function using the AAA pattern: set up inputs, execute, and verify the result.

Frequently Asked Questions about testing-patterns

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

FAQPage Schema
What is the AAA pattern and why should I use it for writing tests?

The AAA pattern—Arrange, Act, Assert—structures tests into three clear phases: set up inputs and state, execute the code being tested, and verify results. This pattern makes tests more readable, maintainable, and easier to debug by separating setup from execution from verification.

How do I write unit tests with proper naming conventions and structure?

Use the AAA pattern to organize each test: arrange test data, act by calling the function, assert the outcome. Name tests descriptively to reflect what they verify. Follow a consistent naming scheme like `test_[function]_[scenario]_[expected_result]` so intent is immediately clear.

When should I mock dependencies in unit tests versus integration tests?

Mock external dependencies—databases, APIs, services—in unit tests to isolate the code under test and ensure fast, deterministic results. In integration tests, use real dependencies or test doubles that closely simulate production behavior to catch interaction bugs.

What makes a test fast, deterministic, and maintainable?

Fast tests minimize external I/O and use mocks; deterministic tests produce the same result every run with no random state; maintainable tests have clear names, minimal setup, and test one behavior. The quality checklist ensures tests remain reliable as code evolves.

How much test coverage do I need and what's the best strategy?

Focus coverage on critical paths and edge cases rather than aiming for a percentage. Use coverage metrics to identify untested code, but prioritize tests that verify behavior over line count; a few well-structured tests catch more bugs than shallow coverage.

Can I apply these testing patterns to integration tests as well as unit tests?

Yes. The AAA pattern, naming conventions, and quality checklist apply to both. Integration tests follow the same structure but operate across multiple components; adjust mocking strategy to test interactions while keeping tests fast and deterministic.