testing-anti-patterns

Audit test suites to replace mock-focused assertions with real-behavior checks.

6|Updated Dec 7, 2025
One-click install
npx skills add https://github.com/timequity/plugins --skill testing-anti-patterns-timequity
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: testing-anti-patterns
Source: https://github.com/timequity/plugins/tree/main/craft-coder/testing-anti-patterns
Command: npx skills add https://github.com/timequity/plugins --skill testing-anti-patterns-timequity

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Helps teams recognize and avoid common testing anti-patterns that erode test quality.

Core Features & Use Cases

  • Anti-pattern explanations and fixes
  • Gate checks for mocks and test-only production code
  • Quick-reference checklist for test quality

Quick Start

Identify and avoid the top 2-3 anti-patterns in your test suite.

Frequently Asked Questions about testing-anti-patterns

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

FAQPage Schema
How do I identify mock-based testing anti-patterns in my unit tests?

Mock-based anti-patterns occur when tests verify mock mechanics instead of real behavior. Common signs include assertions on mock calls without validating actual output, test-only methods in production code, and mocks that leak into production logic. Audit your test suite to replace mock-existence checks with real-behavior verification.

What's the difference between testing mock behavior versus testing actual behavior?

Testing mock behavior verifies that a mock was called or configured correctly—a test anti-pattern. Testing actual behavior validates that your code produces the correct output under real conditions. Replace assertions like "mock.called" with assertions on actual return values, side effects, and integration results.

How do I remove test-only methods from production code?

Test-only production methods create tight coupling between tests and code, making tests brittle. Refactor by moving setup and teardown logic into proper test utilities, using dependency injection instead of test hooks, and ensuring mock management stays in the test layer, not production.

Can I use mocks in integration tests without creating anti-patterns?

Yes, but with discipline. Integration tests using mocks must still assert on real behavior outcomes, not mock invocations. Ensure mocks augment real code paths rather than replacing them, manage mock setup and cleanup through proper test utilities, and avoid test-only conditionals in production logic.

What's the best way to audit and fix a test suite for anti-patterns?

Use a quality checklist covering mock-existence checks, test-only production code, and mock-focused assertions. Run gate checks against your test suite to flag these patterns. Replace each anti-pattern by rewriting assertions to verify real behavior, moving test utilities into proper helper functions, and removing production code branches that only serve tests.