Like a lot of people, I like to have well tested code, and like a lot of people I sometimes find it hard work to write good tests for my code. Sometimes the solution is just to get better at writing tests, but I've often found that when I'm struggling to write a good test for some code, it's a sign that there's something I could improve about the code itself.
In this talk, I'd like to explain why I think this happens. I'll then give a series of examples of problems that I've encountered when testing code, and how you can solve these problems, often by applying fairly basic principles, while making your code better at the same time.
The talk should be accessible to programmers of all levels.