DEV Community

Chanh Le
Chanh Le

Posted on • Edited on

Is Unit Test really a MUST?

I have read the Refactoring book from Martin Fowler, and I am quite confused with the idea of using unit tests for refactoring.

I feel like what we actually need is integration test instead. Because when we do refactoring we will inevitably change the “unit” and then the unit test become outdated and useless and we have to remove them eventually. In the other hand, the integration test is still valid and doing its job, catching bugs and side-effects.

Now, I don’t know whether we still need unit tests for any reason! Yes, running integration tests takes time but we will not run them too frequently and also they will less likely outdated over time or be deleted during refactoring.

Does it make sense? Am I getting anything wrong somewhere?

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Explore a sea of insights with this enlightening post, highly esteemed within the nurturing DEV Community. Coders of all stripes are invited to participate and contribute to our shared knowledge.

Expressing gratitude with a simple "thank you" can make a big impact. Leave your thanks in the comments!

On DEV, exchanging ideas smooths our way and strengthens our community bonds. Found this useful? A quick note of thanks to the author can mean a lot.

Okay