DEV Community

Łukasz Reszke
Łukasz Reszke

Posted on

Good unit test vs bad one?

What's the difference between good and bad unit tests? 🧐

Bad unit tests feel right in the beginning. They let you feel confident, because hey, you write tests.

But nothing really changes 🙊 , once you get into the refactoring part, and you have to refactor tests as well. And their assertions for the result. This leads to even longer development, even though you invested time in tests at the begging of the project.
So this leads us to the conclusion that… not are tests are equally valuable. Some of them raise false alarms. Some unit tests don't help you catch regression errors. Bad unit tests may be as well slow and are difficult to maintain.

Don't write unit tests just for sake of writing unit tests!

Focus on high-quality tests 🚀
💻 They'll help you develop and design code, that is sustainable.

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay