- Motivation
- Removes dependence upon problematic services during
testing
- Summary
- It actually mock original third party or remote services and generally used for testing and development purposes.
- It is also know as Mock Object.
- When to Use
- When you are using third party web services that are beyond yo control.
- Overview Tutorials
- http://martinfowler.com/eaaCatalog/serviceStub.html
- Implementation
- Service stub is generally implemented with the help of Gateway.
- The Gateway is a
Separated Interface rather than a
class so you can have one implementation that calls the real service and at least one that's only a Service Stub.
- The desired implementation of the Gateway should be loaded using a Plugin.
- The key to writing a Service Stub is that you keep it as simple as possible—complexity will defeat your purpose.
- Example
- Mock Objects in Unit testing are good example of service stub pattern.
- Related Patterns
- Gateway
- Separated Interface
- Plugin
- Related Technologies
- Unit Testing Frameworks
- Moles
- References
- None
|
|