What problem does it solve?
This Skill helps you avoid common mistakes in test writing that lead to unreliable, brittle, or misleading tests. It ensures your tests verify actual behavior, not just mock interactions, preventing false confidence in your codebase.
Core Features & Use Cases
- Mock Behavior Prevention: Guides against testing mocks instead of the actual component behavior, ensuring tests are meaningful.
- Production Code Purity: Prevents adding test-only methods to production classes, keeping your codebase clean and focused.
- Dependency Understanding: Ensures you fully understand dependencies before mocking, avoiding broken test logic and mysterious failures.
- Use Case: When writing new tests or refactoring existing ones, use this Skill to identify and correct anti-patterns that compromise test quality and reliability.
Quick Start
Before asserting on any mock element, ask:
"Am I testing real component behavior or just mock existence?"
If testing mock existence, STOP. Test real behavior instead.
Example of a bad assertion (testing mock):
mockSidebar.Verify(x => x.IsVisible, Times.Once);
Example of a good assertion (testing real behavior):
Assert.Contains("navigation", result.Content);