Dummies are the most basic testing doubles at our disposal; they don’t offer any functionality and cannot be used to verify expectations. The main use case for dummies is to fulfill arguments when calling methods and functions.

The ShapeProtocol below defines the draw method, and several different shapes can conform to it.

protocol ShapeProtocol {
    func draw(at point: CGPoint, radius: Float)

One of the possible objects conforming to the ShapeProtocol is the dummy type below. It doesn’t have any implementation and, when its method is called, it doesn’t do anything.

class ShapeDummy: ShapeProtocol {
    func draw(at point: CGPoint, radius: Float) {
        /* no implementation here */

In the example below, no matter which shape is passed to shouldDraw(shape:), the output is always the same, false.

func shouldDraw(shape: ShapeProtocol) -> Bool {

In this situation a dummy, ShapeDummy in this case, is the most basic type which can be used to fulfill the function signature.

let result = shouldDraw(shape: ShapeDummy())

In fact, they are so minimal and limited most people just ignore them and use a mock instead. It’s not worth the overhead of creating and maintaining dummies.

Where to go from here:

  1. Introduction
  2. The Different Types of Tests
  3. Test Doubles
    1. Dummies
    2. Mocks
    3. Stubs
    4. Partials
    5. Fakes
  4. Fixtures
  5. Frameworks and Tools