DEV Community

Nikolaos Gkogktzilas
Nikolaos Gkogktzilas

Posted on

Can a high quality software test suite let you get away with low quality code?

The sort answer would be... "yes, for a while".

The a-bit-longer answer would be...

The goal of having a test suite is to validate that certain use cases function as expected. Thus, no matter how the internals of your systems look, if you can validate that the uses cases work as expected... you should be good!

This might sound counterintuitive and many of you might be thinking "fix your system and write tests for your new code". I understand that point... however the thing is that, in a running business context it's very hard to just re-write a project or deprecate an old version of a project and move all customers to new one. Even re-factoring can be "dangerous" unless you have something to test the changes against to verify the changes.

Some of you might be thinking "you might be able to verify use cases, but with bad/legacy code you won't have fun releasing new features". That is also a valid point!! Just because you managed to make a high quality test suite in order to "cover your **s" from buggies, that doesn't mean that you will be able to release features faster. The test suite though, should be able verify that your hustle through bad/legacy code didn't break anything.

From the above points we see that, if you haven't taken care of your codebase, just testing/verifying your use cases wont get you very far on its own . Having such a test suite though, can be a great tool in the process of improving/re-factoring your system. Having documented and written test suites can help you verify that changes in code work in the same way. Additionally, in the case of re-write, it can help verify that the same use cases are working in the same expected way in old/new code.

Conclusion

Before you just straight into re-factoring or re-writing a codebase, I think it would be wise to spend some time documenting and testing your current use cases. In that way, you will be able to verify that old/new code work in the same way without any disruptions for your users when you release that code (hopefully🤞).

Image of Timescale

Timescale – the developer's data platform for modern apps, built on PostgreSQL

Timescale Cloud is PostgreSQL optimized for speed, scale, and performance. Over 3 million IoT, AI, crypto, and dev tool apps are powered by Timescale. Try it free today! No credit card required.

Try free

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Engage with a sea of insights in this enlightening article, highly esteemed within the encouraging DEV Community. Programmers of every skill level are invited to participate and enrich our shared knowledge.

A simple "thank you" can uplift someone's spirits. Express your appreciation in the comments section!

On DEV, sharing knowledge smooths our journey and strengthens our community bonds. Found this useful? A brief thank you to the author can mean a lot.

Okay