testing-anti-patterns

Detect testing anti-patterns in codebases during test reviews and CI validation.

205|26|Updated Oct 30, 2025
One-click install
npx skills add https://github.com/LerianStudio/ring --skill testing-anti-patterns-lerianstudio
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: testing-anti-patterns
Source: https://github.com/LerianStudio/ring/tree/main/skills/testing-anti-patterns
Command: npx skills add https://github.com/LerianStudio/ring --skill testing-anti-patterns-lerianstudio

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Common testing mistakes like testing mock behavior, polluting production code with test-only methods, or mocking without understanding dependencies lead to brittle, unreliable, and misleading tests.

Core Features & Use Cases

  • Never Test Mocks: Enforces testing real component behavior, not mock existence or functionality.
  • No Test-Only Production Code: Prevents polluting production classes with methods solely for testing.
  • Understand Before Mocking: Mandates understanding a method's side effects before mocking it to avoid breaking test logic.

Quick Start

I'm writing a new test. Use the testing-anti-patterns skill to ensure I avoid common mistakes.

Frequently Asked Questions about testing-anti-patterns

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

FAQPage Schema
How do I avoid testing mock behavior instead of real code?

Testing mock behavior verifies the mock itself, not your actual component. Never test mocks—instead test real behavior by calling actual methods and asserting on their side effects. This ensures your tests validate production code, not test artifacts.

Why shouldn't I add test-only methods to production code?

Test-only methods pollute production classes and create maintenance debt. Keep production code clean by testing through public interfaces only. If you need special test access, redesign the class or use dependency injection—never add methods solely for testing.

What happens when I mock without understanding dependencies?

Mocking without understanding a method's side effects breaks test logic and creates brittle tests. Before mocking, understand what the dependency does, what it returns, and what external effects it triggers. This prevents false positives and misleading test results.

How can I detect testing anti-patterns in my codebase?

Detect testing anti-patterns during test reviews and CI validation by checking for over-mocked behavior, test-only production methods, and mocks used without understanding dependencies. Integrate pattern detection into linters and quality gates to emit actionable signals before code merges.

What's the difference between testing mocks and testing real behavior?

Testing real behavior verifies actual component logic and side effects against requirements. Testing mocks only verifies the mock exists or responds correctly, missing real production failures. TDD enforces testing real behavior to catch actual bugs and ensure reliable code.

Can testing anti-patterns cause flaky tests?

Yes. Over-mocking, test-only production code, and mocks without understanding dependencies create flaky tests that pass locally but fail in production. Eliminating these anti-patterns ensures tests accurately reflect real component behavior and reduce false failures.