How to use it

In general the steps will follow this simple pattern:

  1. Create the mock
  2. Define behaviour
  3. Inject the mock into the component under test
  4. Run the component under test
  5. Optionally verify how the mock was called

There's a subtle yet important difference between mocking and stubbing. Stubbing typically involves faking what data is returned by an object, while mocking is faking the behaviour. See the pages on Stubbing and Mocking for examples.


mocking mocking Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.