Michael

22%
Flag icon
The rule of thumb is that if we want to test interactions between components, mocks might be a better approach than stubs. Mock libraries allow us to specify the interactions in a concise and exact manner. Stubs, on the other hand, are more useful as scaffolding—dependencies that components expect to be present and to perform certain roles. Stubs should be used for secondary components used by the component under test. The test purpose in this case is to test the primary component itself, rather than its interactions with other components.
Next Generation Java Testing: TestNG and Advanced Concepts
Rate this book
Clear rating