testing-anti-patterns

Guide developers to avoid testing anti-patterns by verifying real behavior.

1|Updated Mar 4, 2026
One-click install
npx skills add https://github.com/Kuass/kiro-gateway-plus --skill testing-anti-patterns-kuass
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: testing-anti-patterns
Source: https://github.com/Kuass/kiro-gateway-plus/tree/main/.opencode/skill/testing-anti-patterns
Command: npx skills add https://github.com/Kuass/kiro-gateway-plus --skill testing-anti-patterns-kuass

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps developers avoid common anti-patterns in software testing, ensuring that tests accurately verify real behavior rather than mock implementations, and preventing production code from being polluted with test-specific logic.

Core Features & Use Cases

  • Identify and correct testing anti-patterns: Focuses on preventing the testing of mock behavior, the addition of test-only methods to production code, and mocking without a clear understanding of dependencies.
  • Promotes robust testing practices: Encourages adherence to principles like Test-Driven Development (TDD) to build more reliable and maintainable test suites.
  • Use Case: When writing unit tests for a new feature, this Skill guides you to ensure you're testing the actual functionality of your code, not just the behavior of the mock objects you've set up.

Quick Start

Use the testing-anti-patterns skill when writing or changing tests to ensure you are not testing mock behavior.

Frequently Asked Questions about testing-anti-patterns

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

FAQPage Schema
Why are my unit tests passing but failing to catch real bugs in production code?

Unit tests pass but miss real bugs when they verify mock behavior instead of actual functionality. This common testing anti-pattern occurs when mocks are configured without understanding dependencies, causing tests to validate the mock setup rather than the real code behavior.

What is a test-only method in production code and how do I avoid it?

A test-only method is production code added solely to support unit tests, which pollutes the codebase. Avoid this testing anti-pattern by using Test-Driven Development (TDD) to design testable interfaces naturally, preventing the need for test-specific logic in production.

How do I know when I should mock a dependency during unit testing?

You should mock a dependency only after ensuring a proper understanding of its actual behavior. Mocking without this understanding leads to testing mock behavior rather than real functionality, creating unreliable unit tests that fail to validate actual code paths.

How does TDD prevent common testing anti-patterns during refactoring?

TDD prevents testing anti-patterns by driving code design through tests first, ensuring you test real behavior rather than mock implementations. This approach naturally eliminates the need for test-only methods in production code and clarifies dependency boundaries before mocking.

What is the best way to ensure my unit tests verify real behavior instead of mock behavior?

The best way to ensure unit tests verify real behavior is to focus tests on actual functionality rather than mock implementations. Use gate functions at critical decision points during test development to validate that dependencies are understood before mocking.

When should I not use mocking in my unit tests?

You should not use mocking when you lack a proper understanding of the dependency's real behavior. Mocking without this understanding leads to testing anti-patterns where tests validate the mock setup rather than the actual code, resulting in false confidence during refactoring.