mockito
Installation
SKILL.md
Mockito Skill
This skill defines how to correctly use the mockito package for mocking in Dart and Flutter tests.
1. Mock vs. Fake vs. Real Object
| Use | When |
|---|---|
| Real object | Prefer over mocks when practical. |
Fake (extends Fake) |
Lightweight custom implementation; override only the methods you need. Prefer over mocks when you don't need interaction verification. |
Mock (extends Mock) |
Only when you need to verify interactions (call counts, arguments) or stub dynamic responses. |
- Data models should not be mocked if they can be constructed with stubbed data.
- Only use mocks if your test has
verifyassertions; otherwise prefer real or fake objects.