Testing Anti-Patterns

Educate developers on common testing anti-patterns and how to avoid them.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/Slooowlly/meu-modo-carreira-v4 --skill testing-anti-patterns-slooowlly
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Testing Anti-Patterns
Source: https://github.com/Slooowlly/meu-modo-carreira-v4/tree/main/.agent/skills/testing-anti-patterns
Command: npx skills add https://github.com/Slooowlly/meu-modo-carreira-v4 --skill testing-anti-patterns-slooowlly

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps developers avoid common mistakes and anti-patterns when writing tests, ensuring tests are robust, reliable, and truly verify behavior rather than implementation details of mocks.

Core Features & Use Cases

  • Identify and correct anti-patterns: Learn to avoid testing mock behavior, adding test-only methods to production code, and mocking without understanding dependencies.
  • Improve test quality: Write tests that focus on actual functionality and behavior, leading to more maintainable and trustworthy code.
  • Use Case: When refactoring a complex module, this Skill guides you to ensure your new tests accurately reflect the module's intended behavior and don't break due to changes in underlying dependencies or mock implementations.

Quick Start

Use the Testing Anti-Patterns skill to review the test suite for the new user authentication module.

Frequently Asked Questions about Testing Anti-Patterns

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

FAQPage Schema
Why do my unit tests break when I change mock implementations?

Unit tests break when you test mock behavior instead of actual functionality. This anti-pattern couples tests to implementation details. Focus on verifying real module behavior and understanding dependencies before mocking to ensure tests remain robust and maintainable.

How do I avoid adding test-only methods to production code?

Avoid adding test-only methods to production code by designing modules with testable public interfaces. Adding test-only methods is an anti-pattern that exposes internal details. Instead, verify real behavior through public APIs and structure dependencies correctly to support natural testing.

What are common testing anti-patterns when writing unit tests?

Common testing anti-patterns include testing mock behavior rather than real functionality, adding test-only methods to production code, mocking without understanding dependencies, incomplete mocks, and treating integration tests as an afterthought rather than a core part of the suite.

When should I not use mocking in unit tests?

You should not use mocking when you do not fully understand the dependencies of the module under test. Mocking without this understanding leads to incomplete mocks and tests that fail to accurately reflect the intended behavior, reducing the reliability of your test suite.

How do I review my test suite for common testing anti-patterns?

Review your test suite for common testing anti-patterns by checking if tests verify real behavior instead of mock behavior, ensuring no test-only methods exist in production code, and confirming that integration tests are properly structured rather than treated as an afterthought.

What's the best way to write tests that don't rely on implementation details?

The best way to write tests independent of implementation details is to test actual functionality and behavior. Avoid mocking without understanding dependencies, and structure tests to verify the module's intended behavior rather than the internal mechanics of mocks.