...
Do not re-invent the wheel. Every homegrown mock, test tool or framework needs to itself be tested and maintained. There are tons of good testing frameworks and tools out there, use those instead.
Anchor | ||||
---|---|---|---|---|
|
Maintain testing code as you would production code. This means keep the test code clean and extract re-usable code when it makes sense to do so.
...
A test that requires many mocks usually indicates that the class under test is breaking the Single Responsibility Principle or the Law of Demeter and may need to be refactored.
Comments:
...
Dependencies Difficult to Mock
...
A Lot of Repeated Test Code
See Best Practices, Smells and Anti-Patterns.
Creating Mocks Manually
Test Multiple Behaviors in a Single Test
...