DEV Community

Oliver Davies
Oliver Davies

Posted on • Originally published at oliverdavies.uk on

Automated tests prevent you from adding regressions

Continuing from my last few emails, as well as adding the new use case more easily and quicker, having automated tests also saved me from adding a regression into the code I was changing.

I'd written a condition in the query to ensure only results that started with the search term.

Initially, I removed it, but then the tests failed.

This reminded me why I'd written the condition that way, and I was able to re-add my fix differently.

Without the tests, I'd likely have removed it and introduced a regression.

Whilst fixing a bug, I'd have introduced a different bug.

My tests saved me from doing that and I was able to rectify it quickly before pushing to CI or the staging environment.

P.S. Are you still using Drupal 7 and don’t know what’s involved to upgrade to Drupal 10? Book a Drupal 7 upgrade consultation call or an upgrade roadmap.

AWS Q Developer image

Your AI Code Assistant

Automate your code reviews. Catch bugs before your coworkers. Fix security issues in your code. Built to handle large projects, Amazon Q Developer works alongside you from idea to production code.

Get started free in your IDE

Top comments (0)

Qodo Takeover

Introducing Qodo Gen 1.0: Transform Your Workflow with Agentic AI

While many AI coding tools operate as simple command-response systems, Qodo Gen 1.0 represents the next generation: autonomous, multi-step problem-solving agents that work alongside you.

Read full post →

👋 Kindness is contagious

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

Okay