Sam Hogarth

Newcastle upon Tyne, England, United Kingdom

Testing that the code does what the code does

When unit testing goes wrong, what can we do to make it right?

So many tests, doing so little. Every time you want to make a change, even just to refactor the code, there's loads of test failures! You hear yourself cry out "these tests are taking too long to fix". You're wading through treacle. Why is a test failing because a variable was renamed?!

Let's go back to basics. We'll discuss what unit tests are meant to achieve and develop Object-Oriented Design techniques to get out of this hole. We'll use these techniques to learn how to build maintainable tests that empower rather than hinder change. We'll focus on observable outcomes. We'll blur the lines with integration testing as we learn what a 'unit' is. Mocks, stubs, spies, fakes, doubles - we'll learn where they should and shouldn't be used.

You will take away from this thought-provoking session new perspectives on testing and design principles, learning how the two go hand-in-hand, rather than competing against each other.

This is both a testing and OOP-design-heavy talk.

Originally developed for and delivered at NE-RPC. See this in action at https://samhogy.co.uk/talks/testing-that-the-code-does-what-the-code-does.html


Sam Hogarth

Senior Developer, Tesco Bank

Sam is fascinated with making teams work together better, and keeping up with the ever-changing world of software engineering. He has a decade's worth of experience in highly-regulated environments, across finance, biotech and energy. Whether it's mobile, desktop, web, server or cloud, he has the battle scars. In his spare time, he can run a fine game of Dungeons and Dragons!

Sam's full speaker profile