MCPInstall

testing-patterns

Unit testing and integration testing best practices

Installs
58
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/langchain-ai/skills-benchmarks --skill testing-patterns
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads testing-patterns automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

Testing Patterns

Write effective, maintainable tests using modern patterns.

Test Structure (AAA Pattern)

def test_user_registration():
    # Arrange
    user_data = {"email": "test@example.com", "password": "secure123"}

    # Act
    result = register_user(user_data)

    # Assert
    assert result.success is True
    assert result.user.email == "test@example.com"

Mocking External Services

from unittest.mock import Mock, patch

@patch('services.email.send_email')
def test_sends_welcome_email(mock_send):
    mock_send.return_value = True

    register_user({"email": "test@example.com"})

    mock_send.assert_called_once_with(
        to="test@example.com",
        template="welcome"
    )

Fixtures and Factories

import pytest
from factories import UserFactory

@pytest.fixture
def user():
    return UserFactory.create(role="admin")

@pytest.fixture
def authenticated_client(user):
    client = TestClient(app)
    client.login(user)
    return client

def test_admin_dashboard(authenticated_client):
    response = authenticated_client.get("/admin")
    assert response.status_code == 200

Integration Tests

@pytest.mark.integration
def test_full_checkout_flow(db_session, stripe_mock):
    # Create test data
    user = create_user()
    product = create_product(price=100)

    # Execute flow
    cart = add_to_cart(user, product)
    order = checkout(cart, payment_method="card")

    # Verify
    assert order.status == "completed"
    assert stripe_mock.charges.create.called

Test Coverage Goals

  • Unit tests: 80%+ coverage
  • Integration tests: Critical paths
  • E2E tests: Happy paths only

FAQ

What does the testing-patterns skill do?

Unit testing and integration testing best practices

How do I install testing-patterns?

Run npx skills add https://github.com/langchain-ai/skills-benchmarks --skill testing-patterns in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/testing-patterns/ (personal) or .claude/skills/testing-patterns/ (project).

Which AI agents can use testing-patterns?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is testing-patterns safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains testing-patterns?

It is published by langchain-ai in langchain-ai/skills-benchmarks, and it is an official skill from the maker of the technology it covers. It has 58 recorded installs.

More from langchain-ai/skills-benchmarks

View all →

react-components

langchain-ai/skills-benchmarks

Modern React component patterns with hooks and TypeScript

OfficialFrontend & Design85 installs

langgraph-fundamentals

langchain-ai/skills-benchmarks

Open the skill to read its SKILL.md instructions.

OfficialAI & Agents64 installs

langsmith-trace

langchain-ai/skills-benchmarks

Open the skill to read its SKILL.md instructions.

OfficialAI & Agents64 installs

langchain-oss-primer

langchain-ai/skills-benchmarks

Open the skill to read its SKILL.md instructions.

OfficialAI & Agents62 installs

langchain-dependencies

langchain-ai/skills-benchmarks

Open the skill to read its SKILL.md instructions.

OfficialAI & Agents61 installs

api-docs

langchain-ai/skills-benchmarks

Open the skill to read its SKILL.md instructions.

OfficialBackend & APIs60 installs

Popular testing & qa skills

View category →

tdd

mattpocock/skills

Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions "red-green-refactor", or wants integration tests.

Testing & QA1.2M installs

grilling

mattpocock/skills

Grill the user relentlessly about a plan, decision, or idea. Use when the user wants to stress-test their thinking, or uses any 'grill' trigger phrases.

Testing & QA996.2K installs

migrate-to-shoehorn

mattpocock/skills

Migrate test files from as type assertions to @total-typescript/shoehorn. Use when user mentions shoehorn, wants to replace as in tests, or needs partial test data.

Testing & QA484.1K installs

run-train

lllllllama/rigorpilot-skills

Rigor Train skill for deep learning research repositories. Use when a documented or selected training command should be run conservatively for startup verification, short-run verification, full kickoff, or resume, with command, config, seed, log, checkpoint, status, and metric evidence written to standardized trainoutputs/. Do not use for environment setup, exploratory sweeps, speculative idea implementation, or end-to-end orchestration.

Testing & QA337.8K installs

test-driven-development

obra/superpowers

Use when implementing any feature or bugfix, before writing implementation code

Testing & QA261.8K installs

Use when implementation is complete, all tests pass, and you need to decide how to integrate the work

Testing & QA216.8K installs