DEV Community

Oliver Davies
Oliver Davies

Posted on • Originally published at oliverdavies.uk on

When should you start writing tests?

When you start a new project, when should you start writing tests and doing test-driven development?

Is it before you write any code, or is it something you can start later?

When starting versa, I was only scaffolding the console commands and running some basic commands such as "composer install" and "phpunit".

At that point, there wasn't any business logic to test.

The first versions only supported PHP, so there was no complexity around which language the project used.

There was no logic to determine which language or package manager was used.

Now I've started to add this functionality - such as determining the project type from its composer.json or package.json file - there is logic to test, and I've started to write tests and do test-driven development.

At this phase, I can see the value, which I couldn't when setting up the application to begin with, and different have any logic worth testing.

P.S. Do you need immediate access to an expert Drupal Developer? With my Drupal development subscription, make unlimited requests for a fixed monthly price in less time than posting to a job board!

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 →

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

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

Okay