Member-only story

Writing tests is NEVER a mistake…

Greg L. Turnquist
3 min readJun 1, 2022

…even if the “main” code doesn’t need to change.

As the lead for Spring Data JPA, I have had to learn a LOT of details about how this toolkit works. Nothing shakes you up more than being handed the reins to a critical project and then opening up your first “new” issue the next day.

And being The One that has to deal with it.

People often open new tickets against Spring Data JPA. With people selecting SQL-based data stores over NoSQL-based data stores at an average of 4-to-1 on new projects, it makes this project popular. And when have troubles, they open tickets.

So one of my first steps is to simply glean what went wrong. Sometimes it’s plain as day and I can point it out. But more often than not, they have a specific situation in their application where something went awry.

And so the first thing I reach for, if not spotting it as an Already Solved issue, is to see how easy it is to write a test case.

And this is where I smile.

Because automated test cases are the key toward learning a new project. Every time we write a test case, it forces us to understand how the system works. How a single module works. How a single function works.

And with each test case, our understanding grows.

It takes patience. It takes endurance. If you want to become a pro developer, this is the kind of thing you will experience day in and day out. Not the glittery, uber-existing thing where you assemble a Twitter-lookalike in 45 minutes like I’ve seen at conference talks. That stuff is fun, but it’s not representative of the grind software geeks face.

We must reproduce problems, diagnose if they REALLY exist, and if so, decide what the solution is. (Or..wink wink…what the solution is NOT. Sometimes, a solution isn’t warranted, but that’s for another article.)

And over time, as we write more and more tests, we will learn more and more of the system. We will, over time, build up a knowledge of how all the parts work together.

And this is why, sometimes even if there is no actual problem to fix in a given issue, I’ll sometimes add the newly minted test cases to the codebase!

--

--

Greg L. Turnquist
Greg L. Turnquist

Written by Greg L. Turnquist

Sr. Staff Technical Content Engineer at CockroachDB • YouTube Content Creator at https://youtube.com/@ProCoderIO • Best-Selling Author • Coffee Lover

No responses yet

Write a response