Testing Anti-Patterns

Identify common testing anti-patterns that undermine test suite reliability.

Updated Dec 30, 2025
One-click install
npx skills add https://github.com/vietlinhh02/cogninote --skill testing-anti-patterns-vietlinhh02
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Testing Anti-Patterns
Source: https://github.com/vietlinhh02/cogninote/tree/main/.claude/skills/methodology/testing-anti-patterns
Command: npx skills add https://github.com/vietlinhh02/cogninote --skill testing-anti-patterns-vietlinhh02

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps developers identify and avoid common mistakes in writing automated tests that can lead to false confidence and missed bugs.

Core Features & Use Cases

  • Identify Mocking Issues: Learn to test real behavior, not just mock interactions.
  • Prevent Code Pollution: Keep test-specific code out of production.
  • Improve Test Robustness: Write tests that accurately reflect expected outcomes.
  • Use Case: When reviewing a pull request for new test code, use this Skill to quickly spot and correct anti-patterns before they are merged.

Quick Start

Use the testing anti-patterns skill to explain the problem of testing mock behavior instead of real code.

Frequently Asked Questions about Testing Anti-Patterns

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

FAQPage Schema
What are common testing anti-patterns that create false confidence in unit tests?

Common testing anti-patterns include testing mock behavior instead of real code, polluting production code with test-specific logic, using incomplete mocks, and writing tests as an afterthought. These issues undermine test suite reliability and lead to missed bugs.

How do I stop polluting production code when writing integration tests?

To stop polluting production code, keep test-specific code entirely out of your production logic. This Skill helps identify and correct anti-patterns where test-specific code has leaked into production, ensuring tests validate real behavior without compromising the production codebase.

Why does testing mock behavior instead of real code undermine test reliability?

Testing mock behavior instead of real code undermines reliability because it only verifies that mocks are called as expected, not that the actual logic works. This Skill explains how to test real behavior and improve test robustness to accurately reflect expected outcomes.

How do I review a pull request for testing anti-patterns before merging?

You can review a pull request for testing anti-patterns by using this Skill to quickly spot and correct mistakes in new test code. It identifies issues like incomplete mocks and testing afterthoughts, helping developers improve testing practices before code is merged.

When should I avoid using mocks in my software development testing practices?

You should avoid using mocks when they fail to accurately reflect expected outcomes or when they require polluting production code. This Skill helps identify incomplete mocks and explains when testing real behavior is a better approach for improving test suite reliability.