In this tutorial we learn how to use mocks when unit testing, why integration testing is sometimes just not enough, and how to save some trees. 🌳
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. 🇫🇯
Code reviews are a great practice to apply in software development. The approach is very simple: when you’re done with your code, give it to someone else to look at and leave comments.
Despite of its simplicity, it brings considerable advantages. Here are 7 reasons why this practice is useful.
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.
How I sensed a bug while not seeing any, and what came of it.
Today I found a place on our website where we display the size of a recreational area in square kilometers.
I cannot fully explain what happened next, but I had a hunch something must be wrong with this feature.
Narrator: there was.
If you ask me, what’s a single most important thing in writing good code, I’d reply: “Modularization and Dependency Management”.
Well, actually, that’s two things. Sorry about that! But they are two sides of the same coin, and you can’t have one without the other, if you want to your code to be nice and clean.
Are you a perfectionist? That kind of a person that can never say “I’m done”, “it’s ready” or “let’s ship it”? The one who can’t release the new feature unless it’s polished and perfect?
You’re a manager, and your developer tells you they want to refactor something? You’re a developer, but don’t know if you should resist the sudden urge to refactor that ugly piece of code you just saw? Here’re true stories that will help you decide.
So, how do you usually code?