Life's a Riot with Stubs, Fakes, Spies and Mocks

Session type: 120 minutes tutorial

Session level: Beginner

Co-speaker Christopher Chant

Ever wished you had more control over third party API responses? Have you been unable to test specific API responses? Perhaps you’re trying to improve the stability of your automation suites? Have you just started writing unit and integration tests? Maybe you’re building a client for an API that hasn’t been built yet, and you want to get testing earlier? Facing these challenges, mocks, stubs, fakes and spies are essential to testability and can be used both in your automation and as a tool to aid you in your exploratory testing.

In this workshop, the group will explore mocks, stubs, fakes and spies. You’ll come away with ideas on when these techniques are appropriate, how to gradually build up features in the tools you create to mimic services and you will know just how quick it is to go from idea to working tool. Some programming experience is preferred, but anyone who has an interest in testability will find the workshop rewarding.

Key take-aways:

  • Recognise the common terminology used in the stubs, fakes, spies and mocks domain
  • Understand the difference between stubs, fakes, spies and mocks through their characteristics and use cases
  • Apply this foundational knowledge to build a gradually more featured tool to illustrate the journey from stub to fully fledged mock.
  • The systems we test are massively integrated with many different data sources, and this is only going to increase. With the ability to mimic key services, your dependencies won’t be the bottleneck that stops you from delivering information of value, early and often.

Ash Winter is a learning tester, conference speaker, unashamed internal critic, with an eye for an untested assumption or claim. Veteran of various roles encompassing testing, performance engineering and automation either as a team member delivering mobile apps and web services or a leader of teams and change. He helps teams think about testing problems, asking questions and coaching when invited.

A co-organiser for the Leeds Testing Atelier, a full day testing workshop. Its mission is to give those involved in testing a platform to share their stories. It attracts over 100 attendees from various disciplines.