Faking It - The Art of Testing Using Verified Fakes
summary
Claims that shipping verified fakes lets unit tests run quickly while guaranteeing behavior with the real API; evidence includes a working fake for docker-py that initially fails because its keywords and return shapes diverge from the real client but is tightened by zope.interface verifyObject checks and a dynamic test-factory that runs the same test mixin under trial against both fake and integration setups. Real-world examples used: Flocker’s Block Device Backend, Eliot’s memory logger, LibCloud DummyNodeDriver and suggested improvements for Boto; the built fake ends up passing both fake and real tests.
AI-written summary · about
chapters (19)
- 0:00Intro
- 1:00Introduction • Problems (5) • Solution (15) . Questions (5)
- 3:51Problem 2: Inaccurate mocks
- 4:31Nova Docker (for example)
- 7:37Can we do better?
- 7:48A "verified" fake A class that
- 9:44So let's make a start
- 10:04Where is the docker-py API defined?
- 15:14A public testtools module
- 15:55A Tests Mixin
- 18:58And now we can start fleshing out the interface
- 19:22Starting with a test for empty list of containers.
- 20:54Test, write code, refactor, repeat
- 21:58Complications
- 23:36Test public APIs not implementation details
- 24:11Further Reading
- 26:08Mimic
- 27:20Eliot
- 28:51Summary
related talks
26mTesting HTTP APIs with Ruby
25mFakes over Mocks: Shift your paradigm and identify monolithic code
31mFake It to Make It! - TDD of gRPC Microservices
45mStop Using Mocks (for a while)
32mMock It Till You Make It: How to Verify Your External Mocks Without Ever...
41mMocks vs Fakes vs Stubs
27mEffectively Testing Services
27mFake Your Test Away: How To Abuse Your Test Doubles
