Writing Good Unit Tests: A Step By Step Tutorial

A tutorial to help you write comprehensive unit test suites.

Let’s imagine we just wrote a method calculating distance between two points on our planet. And let’s imagine we want to test it as well as possible. How do we come up with test cases? And what exactly do we need to test?

Bonus: learn a surprising fact about the Fiji islands. ūüáęūüáĮ

Continue reading “Writing Good Unit Tests: A Step By Step Tutorial”

Unit testing: best practices

I have been unit testing my code for many years.

While building a GIS-system, we really cared about our product quality. Our users’ needs demanded the app to work properly. I had all critical and/or complex parts of code 100% test-covered, with multiple paths and corner cases. It was such a pleasure to find a bug, fix it, write a couple of¬†tests for this surprise scenario, and be sure it won’t break again. Ah, good times.

Continue reading “Unit testing: best practices”