Mock Dependencies in Tests
When unit testing, you are often interested in testing a portion of a complete system isolated from dependencies. To test a portion of the system, we can use mock objects to replace the dependencies. A mock object implements at least part of the same interface as the production object, but often in a simpler, faster, more predictable, or more controllable way.
To get started, see Create Mock Object.
Classes
Topics
- Create Mock Object
Test a portion of a complete system in isolation using a mock.
- Specify Mock Object Behavior
Define behavior for mocked methods and properties. For example, you can specify that a method returns predefined values.
- Qualify Mock Object Interaction
Intercept messages sent from the component under test to the mock object. For example, you can verify that a method was called or a property was set.
- Write Tests That Use App Testing and Mocking Frameworks
Create fully automated tests for an app by using the app testing framework and the mocking framework.