General Fixture
Test setup is too big/general for the specific test.
Meszaros, xUnit Test Patterns
Signs of Use (Symptoms)
-
beforeEachcreates 20 objects, but test uses only 1. - Shared fixture makes tests interdependent.
Refactoring Solution
- Minimal fixture per test.
- Use factory functions to create only what’s needed.
Code example
Bad
Good