← Back to glossary

Test Driven Development (TDD)

Test Driven Development (TDD) is a development practice that involves writing tests before the code they are intended to validate.
The cycle is simple: write a failing test, write the minimal code to make it pass, then refactor. This method encourages a better-designed, simpler, and more reliable code over time.

Related Services

Related Terms

TDD in practice

Why practice TDD

  • Encourages designing the API before implementation - simpler code to use.
  • Safety net for refactoring - one can clean up without fear.
  • Living documentation: tests describe the intention.
  • Reduces regressions and the cost of technical debt.

The TDD cycle

  1. Red - write a test that fails.
  2. Green - write the minimal code to make it pass.
  3. Refactor - improve the structure without breaking the tests.

Caveats

  • TDD ≠ 100% coverage. Test what has value (business logic, edge cases).
  • On legacy code, start with API or end-to-end tests.
  • Essential collective discipline - if some practise it and others don't, the balance is broken.

How Galadrim can support you

See our offering Custom development.

[Contact us]

Let's bring your project to life together

We work with all types of clients, across all sectors. Whether you're an entrepreneur or managing a large organisation, a tailored team will meet your needs.

Over 800 companies have trusted us to create their web, mobile, and AI products

Your enquiry

We'll get back to you within 1 hour.