Terminology

Terminology can be a bit confusing, especially since different people use different names for the same thing. To make things even more complicated, mocking frameworks tend not to be consistent when naming their methods.

Before we proceed, let us briefly go through terminology.

Test doubles is a generic name for all of the following types:

  • Dummy object's purpose is to act as a substitute for a real method argument
  • Test stub can be used to replace a real object with a test-specific object that feeds the desired indirect inputs into the system under test
  • Test Spy captures the indirect output calls made to another component by the System Under Test (SUT) for later verification by the test
  • Mock object replaces an object the SUT depends on, with a test-specific object that verifies that it is being used correctly by the SUT
  • Fake object replaces a component that the SUT depends on with a much lighter-weight implementation

If you are confused, it may help you to know that you are not the only one. Things are even more complicated than this, since there is no clear agreement, nor a naming standard, between frameworks or authors. Terminology is confusing and inconsistent, and the terms mentioned earlier are by no means accepted by everyone.

To simplify things, throughout this book we'll use the same naming used by Mockito (our framework of choice). This way, methods that you'll be using will correspond with the terminology that you'll be reading further on. We'll continue using mocking as a general term for what others might call test doubles. Furthermore, we'll use a mock or spy term to refer to Mockito methods.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.59.79.176