Top 5 Mistakes You’re Probably Making While Unit Testing Your Own Code

There is a big chance you’re doing one of these mistakes and haven’t even noticed

Fernando Doglio
The Startup
Published in
7 min readNov 27, 2020

--

Photo by NeONBRAND on Unsplash

All developers hate unit tests, right? That’s like one of those untold rules, if you’re working as a developer, your focus should be on your working code, let others who know less than you write the filthy tests.

I’ve seen a lot of developers with that mindset in my (almost) 20 years of experience. Heck, I know I was one of them at one point. But the truth is I learned from my mistakes, I eventually understood the role unit tests play within the context of a software project and I just want you to also reach that point.

I want to you enjoy writing tests, because yes, such a thing is possible. And to show you how little attention you’re paying to the task of unit testing, here are 5 mistakes you’re most likely making without even realizing it.

Testing other people’s code

This one is a classic, I probably say the phrase “you’re testing code that you didn’t write” twice a week nowadays. But it’s fine, it’s better to understand this one first since it’s the base mistake for bigger ones.

--

--

Fernando Doglio
The Startup

I write about technology, freelancing and more. Check out my FREE newsletter if you’re into Software Development: https://fernandodoglio.substack.com/