test-doubles

Explain xUnit test patterns, test doubles, and test smells.

Updated Feb 17, 2026
One-click install
npx skills add https://github.com/Objective-Arts/lens-dist --skill test-doubles
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: test-doubles
Source: https://github.com/Objective-Arts/lens-dist/tree/main/canon/test-doubles
Command: npx skills add https://github.com/Objective-Arts/lens-dist --skill test-doubles

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps developers write more maintainable, reliable, and understandable tests by applying established xUnit patterns and understanding the nuances of test doubles.

Core Features & Use Cases

  • Test Double Taxonomy: Learn when to use Dummies, Stubs, Spies, Mocks, and Fakes.
  • Test Patterns: Implement the Four-Phase Test, Fresh Fixture, and Minimal Fixture patterns.
  • Test Smells: Identify and refactor common anti-patterns like Fragile, Obscure, and Eager tests.
  • Use Case: When writing a new test, consult the Test Double Taxonomy to select the most appropriate type of test double, ensuring your test is effective and maintainable.

Quick Start

Explain the difference between a test stub and a test mock.

Frequently Asked Questions about test-doubles

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

FAQPage Schema
What is the difference between a test stub and a test mock?▼

A test stub provides canned answers to calls made during testing, while a test mock verifies that specific interactions occur. This Skill explains the full test double taxonomy, helping you distinguish stubs, mocks, spies, dummies, and fakes.

How do I fix fragile xUnit tests that break during refactoring?▼

To fix fragile xUnit tests, you should refactor anti-patterns using established patterns like Minimal Fixture and Four-Phase Test. This Skill identifies test smells such as fragile, obscure, and eager tests, offering solutions for robust automated tests.

When should I use a test spy instead of a test mock?▼

Use a test spy when you need to record interactions for later verification rather than asserting them upfront like a test mock. This Skill provides comprehensive guidance on selecting the appropriate test double taxonomy for maintainable testing.

How do I structure a Four-Phase Test in xUnit?▼

A Four-Phase Test structures xUnit tests into setup, exercise, verify, and teardown stages. This Skill guides you in implementing this pattern alongside Fresh Fixture and Minimal Fixture patterns to write reliable and understandable tests.

What are common test smells in automated testing and how do I refactor them?▼

Common test smells include fragile, obscure, and eager tests that reduce maintainability. This Skill helps you identify these anti-patterns and apply xUnit test patterns and test doubles to refactor them into robust automated tests.

Do I need xUnit patterns for writing new automated tests?▼

You need xUnit patterns when writing new automated tests to ensure they are maintainable and reliable. This Skill offers guidance on selecting appropriate test doubles and applying patterns like Fresh Fixture to achieve effective software design.