How to Write Great Unit Tests

I’ve written before about automated tests, why we use them at Rare, and how to use them effectively. In the time between then and now I’ve learned a lot about our test systems and tests in general, so I thought it was time for a more in depth look at testing, especially the much maligned unit test.

Unit tests are often considered unnecessary guff that’s just more code to write and maintain- but often they are not given a fair chance. Like any other new technique, we start by writing bad tests on code written without testing in mind, have a miserable time, and write off testing entirely as a bad job. But, writing great tests on great code can be easy peasy. I’m going to cover some specific techniques on how you can write great tests on great code, and get a lot more out of it in the process.

Continue reading