Contribute Media
A thank you to everyone who makes this possible: Read More

Faking It - The Art of Testing Using Verified Fakes

Description

Richard Wall - Faking It - The Art of Testing Using Verified Fakes [EuroPython 2015] [23 July 2015] [Bilbao, Euskadi, Spain]

Have you ever worried that your tests aren't as good because they're running against a fake or mock instead of the real thing? Verified fakes solve this problem. Verified fakes allow for simplified testing using fakes while still providing the assurance that code tested using a fake implementation will behave the same way when used with a real implementation.

The talk will begin with a case-study, demonstrating what it means to write a "verified fake" implementation of a public API. I will show how to write tests that verify a fake implementation of a well defined API and I will show how those same tests can be re-used to verify and test real implementations of the same API.

The talk will end with a proposal that more libraries should include verified fakes. I will show, with real-world examples, how verified fakes can be used by integrators and discuss how they are superior to ad-hoc, unverified, mocking.

During the talk I will refer to various real world, Open Source examples. Including:

  • Flocker's Pluggable "Block Device Backend" [1]

This API allows Flocker to manipulate file systems on OpenStack Cinder Blocks and AWS EBS devices. It also makes it easy for third parties to implement their own Flocker block device backends.

  • Eliot's Memory Logger - and its use in testing and verifying logged messages.
  • LibCloud's DummyNodeDriver - and its limitations.
  • Boto - as an example of a library that could benefit from a verified, introspectable fake.
  • Docker-py - as an example of a library for which we have written a verified fake.

There will be at least 5 minutes for discussion at the end of the talk.

[1] Flocker is an Open Source Docker orchestration system written in Python by ClusterHQ

Details

Improve this page