Alex Collins - Testing - Pt 4 - Test Support and Test Doubles
Document supporting code:
- Test doubles or fixtures won't be reused if people don't know about them or how.
With JUnit, consider using @Rules to provide mixin-esq components for tests.</span>
Prefer fakes:
- They're generally more versatile and reusable than stubs, dummies or mocks.
- They'll give you a better understanding of the subject than other types of doubles.
- They can often share a code with the implementation, and thereby test that as well.
- Have the ability to directly control fakes by an interface, e.g. to put components into error mode that cannot be stimulated by normal APIs, e.g. network issues or hardware failures.
Read full article from Alex Collins - Testing - Pt 4 - Test Support and Test Doubles
No comments:
Post a Comment