The Spy of Testadel: a unit-testing medieval tale
When people get started with unit testing, they often get stumped when it comes to testing functions that have side effects. This talk is a gentle introduction to some of the concepts involved in testing side effects.
The year is 1452. An uneasy truce between the kingdom of Testadel and the fiefdom of its neighbour, Sir SideEffects, is on the verge of collapse. Follow along as our hero, a court jester aptly named Jest, infiltrates the enemy's camp to gather information, and uncover Sir SideEffects' treachery.
Through the clever - I think - use of an allegory, this talk will answer:
- What is the difference between a pure function and a function with side-effects.
- Why testing functions with side-effects is usually harder.
- What strategies can be employed to test functions with side-effects, and their tradeoffs.
- What are spies and how to use them.
- What libraries can help with testing side-effects.