Issue 13 · Nov 2–8, 2026Editions · Glossary · Archive · Method · RSS · HU / ENG

News of the AI era, curated weekly

Glossary › Code

test-driven development (TDD)

advancedwidespread

A programming method where the test is written first, followed only by the code that must pass it.

In plain terms

Imagine a teacher who first writes the answer key for the exam and only then starts teaching the material. This way, from the beginning, they know exactly what the student needs to know at the end. Test-driven development does the same with software: first, they record what it means to "work well," and only then do they write the program itself.

A test here is a small program that tries out the code being prepared and says whether it does what was expected. For example, if an online store's cart must give a 10 percent discount, the test enters an amount and checks whether the final result matches.

This is the reverse of the usual sequence: most people write the program first and test it afterwards. In TDD, the test is the commission and the code is the delivery. In the AI era this has become important again because a coding agent can see clearly from the test when it is done, and does not have to decide for itself whether its work is good enough.

How it works

  1. The developer (or the coding agent) writes a short test for a single small expectation, for example: 'with an empty cart, the total is zero.'
  2. It runs the test, which fails at this stage since the code does not yet exist. This is the 'red' state, proving the test actually measures something.
  3. It writes the simplest possible code that passes the test. This is the 'green' state.
  4. It tidies up the code and makes it clearer while all the tests stay green. This is called refactoring.
  5. The next small expectation arrives, and the cycle restarts. In the end, the multitude of tests provides a safety net: if a later modification breaks something, it is immediately revealed.

An everyday example

You ask a coding agent to write a program that calculates VAT from your invoices. If you first have it write tests for several invoices where you provide the correct final result, and only then ask for the program, you do not have to blindly trust that it calculates correctly: the tests will show.

Who is affected

developerA daily working method that yields fewer hidden bugs and code that can be changed with more confidence, and it is also one of the best tools for steering coding agents. → Code
entrepreneur, executiveIf you order software or have it developed with AI, tests provide tangible proof that the system does what you asked.
parent, student, teacherFor those learning or teaching programming, this method teaches that the goal must be defined precisely first, and only then the solution. → Education & Family

A common misconception

MythIf all tests are green, the program is flawless.
In realityTests only check what someone thought of and wrote into them. What was left out or poorly phrased goes unnoticed by the green light.

Limits and risks

Similar, but not the same

Related concepts

Broader

software development, software testing, agile development, extreme programming

Narrower

unit test, red–green–refactor cycle

On the edge

coding agent, refactoring, continuous integration, specification-driven development, vibe coding

A brief history

American software developer Kent Beck popularized the method as part of extreme programming, then described it in detail in his 2002 book Test-Driven Development: By Example. He himself said that he did not invent the old practice but "rediscovered" it.

Where things stand

A method long known in the software industry, though not consistently applied everywhere. By the end of 2026, it has gained new momentum due to coding agents, because testing is one of the most reliable ways to automatically verify an agent's work.

Status: 2026 November

Also known as

TDD · test-driven development · test-driven development · test-driven programming · test-driven development · test driven development · test-first development · red-green-refactor

Sources

This entry was machine-edited and has undergone machine expert review; the “In the news” section updates automatically from Agent Age stories.