testing-anti-patterns

Detects and corrects common testing anti-patterns involving mocks, test-only methods, and incomplete test coverage.

1|Updated Mar 19, 2026
One-click install
npx skills add https://github.com/tottenjordan/me-skittles --skill testing-anti-patterns-tottenjordan
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: testing-anti-patterns
Source: https://github.com/tottenjordan/me-skittles/tree/main/gemini/testing-anti-patterns
Command: npx skills add https://github.com/tottenjordan/me-skittles --skill testing-anti-patterns-tottenjordan

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Tests often verify mock behavior instead of real code behavior, pollute production classes with test-only methods, or mock dependencies without understanding their side effects, producing suites that pass while proving nothing. ## Core Features & Use Cases - Mock Behavior Detection: Identifies assertions that verify mock existence rather than real component behavior, with gate functions to stop the mistake before it ships. - Production Code Protection: Prevents test-only methods like cleanup helpers from being added to production classes, redirecting them to test utilities. - Dependency-Aware Mocking: Enforces understanding of side effects before mocking, requires complete mock structures mirroring real API responses, and flags over-complex mocks. - Use Case: While writing a test for a duplicate-server detection feature, you are about to mock the config-writing method the test depends on. The skill's gate function stops you, and you mock only the slow server startup instead, preserving the behavior under test. ## Quick Start Review my test file for testing anti-patterns such as asserting on mocks, test-only production methods, or incomplete mock responses.

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?▼

Avoid asserting on mock-specific elements like mock test IDs; instead render the real component and assert on its actual behavior, such as semantic roles. If a component must be mocked for isolation, test the parent's behavior with the mock present rather than the mock itself.

How to handle test cleanup without adding methods to production classes?▼

Move cleanup logic into test utility functions that operate on the object externally, such as a cleanupSession helper in a test-utils module. Production classes should only contain methods used by production code, keeping lifecycle concerns separated.

When should I use mocks versus integration tests?▼

Use mocks to isolate slow or external operations at the lowest level possible. When mock setup exceeds the test logic or mocks miss methods real components have, integration tests with real components are often simpler and more truthful.

Why does my test pass but fail in real integration?▼

A common cause is incomplete mocks that omit fields downstream code depends on, or mocking a high-level method whose side effects the test relies on. Mirror the complete real API response structure and mock only the genuinely slow or external operations.

Does TDD prevent testing anti-patterns?▼

Yes. Writing the test first and watching it fail against real code forces you to test real behavior, reveals actual dependencies before mocking, and prevents test-only methods from creeping into production classes.