Cover image for Four Unexpected Benefits of Writing Tests

Four Unexpected Benefits of Writing Tests

scahhht profile image Scott White ・3 min read

No one likes writing tests.

If you're setting them up for the first time, it's a pain (getting your servers going, training your team on a framework, etc.). Even if you're used to writing them, it can feel like overkill when you're just trying to develop new features that customers will get value from.

Despite being a pain to write, integration tests are a great example of delayed gratification — there's an up-front cost, but they pay for themselves in the long run.

In fact, a test's role in preventing a bug makes it some of the highest-value code an engineer can write.

Tests save time — and not just for the developer

image showing the lifecycle of a bug

Bugs do not exist in a vacuum.

Most bugs are discovered by the users themselves, where they then make the long-and-windy journey back to the developer with the right context. Along the way, a bug might be handled by a support person, who then passes it along to their boss, who might get in touch with a product manager, who will know an engineer who is familiar with that part of the codebase.

At each step in this journey, the bug gets more expensive as time is invested from each stakeholder in its investigation and resolution.

All the while, the customer is waiting for a resolution, every minute more sure that they want to cancel.

Integration tests eliminate that whole journey. The moment a bug is deployed related to someone's code, that person gets notified. No more telephone, no more lengthy resolution process.

Tests improve decision-making

Many companies use A/B testing to measure the impact of new features, or user-facing changes of any kind to their site.

When you introduce more variants (test groups) to your site, you increase the probability of bugs, as you are supporting multiple different versions of the site which in turn increases the overall surface area you need to support.

Bugs in any of these variants can have the effect of skewing the results of your experiment. Furthermore, without test coverage, you may not even be aware that these bugs exist and are influencing the outcome of your experiment.

As such, implementing tests in your experimental code ensures that you don't make important decisions based on flawed data.

Tests help your brand

Social media, customer reviews, and word-of mouth are increasingly the primary ways that millennials make purchasing decisions.

Nothing kills a potential customer's intent to purchase like seeing an angry tweet about a bad bug.

A bug-free experience is a prerequisite for customer acquisition and retention, and integration tests are the best lever you have to ensure that your customer experience is bug-free.

Tests print money

Tests have high ROI on two dimensions: they prevent money-losing bugs, and they help developers spend more of their time building features, not fixing bugs.

For any critical business process (such as customer checkout, coupon code redemption, etc.), tests can make all the difference. Without tests, you increase the probability that a fraudulent actor can exploit your coupon system, or a legitimate customer can't make it through checkout.

Furthermore, while tests have an up-front cost (you have to write them), they save time in the long-run, particularly when you take into account the many stakeholders that are involved in solving bugs.

But writing tests is hard...right?

Historically, writing tests has been a pain. You have to get servers running, adopt a framework, and write them for every new feature.

Writing tests does not have to be hard

With walrus.ai, you can write integration tests in one line of code.

  • ⚡️ Fast: Get results in 5 minutes
  • 🏝 Easy: Write tests in plain English, and we'll handle the rest
  • 👩🏻‍💻 Developer-first: One API call, no sales calls

Try if free!

An integration test being run in a console


Editor guide