Test Double

A Test Double is a replacement component used during testing to simulate the behaviour of real components. It allows testers to isolate specific parts of a system while performing tests.

Types of Test Doubles:

  • Stubs: Provide predefined responses to calls made during tests.
  • Mocks: Verify interactions between components by checking if specific calls were made.
  • Fakes: Implement a simplified version of a component with limited functionality.

Test Doubles are Essential for:

  • Testing components in isolation.
  • Reducing dependencies on external systems during testing.
  • Facilitating faster and more reliable tests.

Using Test Doubles enhances the flexibility and efficiency of the testing process, allowing for more thorough validation of individual components.