test-doubles-strategy
Choosing between mocks, stubs, fakes, spies, and dummies based on testing needs.
от sethdford★ 51 звезда на GitHub
Установить test-doubles-strategy в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Test Doubles Strategy
Strategies for replacing real objects with test doubles.
Context
You are selecting the right test double for the job. Understand the tradeoffs of each approach.
Domain Context
- Stub: Returns canned answers; doesn't care how many times it's called
- Mock: Expects specific calls; verifies behavior
- Fake: Lightweight working implementation; slower but more realistic than stub
- Spy: Records calls; can verify and allow through to real object
- Dummy: Placeholder; passed but never used
Instructions
- Stub: Use when you need predictable return values; database returning test data
- Mock: Use when you need to verify that a dependency was called correctly
- Fake: Use for database or third-party service; test containers are modern fakes
- Spy: Use when you need both verification and real behavior
- Dummy: Use when dependency is required by signature but not used
- Avoid Over-Mocking: If everything is mocked, you're not testing integration
- Prefer Fakes: Modern practice uses test containers over mocks for external services
Anti-Patterns
- Mocking everything; you need at least some real code to test
- Over-specifying mocks; brittle tests that fail on implementation changes
- Mocking your own code; mock external dependencies, not your logic
- Complex mock setup that's harder than the test; use factories or test builders
- Never testing error paths through mocks; ensure your error handling actually works
Further Reading
- Martin Fowler, Test Double essay
- Gerard Meszaros, xUnit Test Patterns
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл test-doubles-strategy?
Choosing between mocks, stubs, fakes, spies, and dummies based on testing needs.
Как установить скилл test-doubles-strategy?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл test-doubles-strategy запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…