🧱Team & process8 min readUpdated: Dec 4, 2026

TDD vs BDD vs DDD: Differences and When to Use Each

TDD vs BDD vs DDD: TDD covers code correctness, BDD the app's behavior and DDD the terms of the business. Learn the differences and when to use each.

👨‍💻
Roman
AboutTheApp

Overview & context

TDD vs BDD vs DDD isn't a choice between three variants of the same approach. They're three methods that solve different problems. TDD (test-driven development) makes sure the code does what it should, because you write the tests before the code. BDD (behavior-driven development) uses examples to describe how the app should behave, so that both the developer and the client understand them. DDD (domain-driven design) focuses on making the app match how the business it's built for actually works. This article compares all three, shows how to combine them and explains where to keep tests, scenarios and a glossary so the whole team can find them.

1. TDD vs. BDD vs. DDD: how they differ

The three methods differ mainly in who takes part and what comes out of them. TDD is purely a developer technique and its result is a set of automated tests. In BDD, the developer sits down with a tester and the client and together they write examples of how the app should behave. DDD involves people who know the business, and the result is a shared glossary and a split of the app into functional parts.

TDDBDDDDD
Question it answersDoes the code work correctly?Does the app do what we agreed on?Does the app match how the business works?
ResultAutomated tests written before the codeScenarios in Given/When/Then formA glossary and a split of the app into parts
Who takes partThe developerDeveloper, tester and clientDevelopers and people who know the business
When it fitsFor any logic you can testWhen the client and developers each read the spec differentlyFor apps with complex rules

2. What is TDD (test-driven development)

TDD is a workflow where the developer first writes a test that fails and only then the code that makes it pass. Kent Beck described it and he sums up its current form in Canon TDD. The developer starts by listing the cases the code has to handle, then turns them into tests and code one at a time.

Each case goes through three steps called red, green and refactor. Here's how they work on a function that adds VAT to a net price.

  1. 1

    Red: write a test that fails

    Write a test for a function that doesn't exist yet and run it. The test has to fail, otherwise it isn't checking anything.

  2. 2

    Green: write code that passes the test

    Write the simplest code that makes the test pass. Don't worry about clean code yet.

  3. 3

    Refactor: clean up the code

    Make the code easier to read, for example by renaming variables or removing repeated parts. Rerun the tests after every change. If one fails, you know right away which change caused it.

invoice.test.js
test("adds 21 % VAT to the net price", () => {
  expect(totalWithVat(100, 0.21)).toBe(121);
});
The TDD cycle. A test fails, passes after code is added and still passes after refactoring. Then the cycle repeats for the next test.

3. What is BDD (behavior-driven development)

BDD is an approach where you describe the app's behavior with concrete examples. The examples are written in plain language that the developer, the tester and the client all understand. BDD grew out of TDD and its author Dan North explains in Introducing BDD that tests should describe the app's behavior, not individual methods in the code.

Each example has three parts: Given describes the starting state, When the user's action and Then the expected result. This format is called Gherkin and tools like Cucumber can run it as an automated test. The biggest benefit of BDD, though, is that you use the examples to clear everything up with the client before you start coding.

credit-note.feature
Feature: Credit note
  Scenario: Credit note for a returned item
    Given an issued invoice for 3 items
    When the accountant issues a credit note for 1 item
    Then the invoice balance drops by the price of 1 item including VAT
The BDD workflow. The team and stakeholders agree on expected behavior, write Given, When, Then scenarios and use them to verify the app.

4. What is DDD (domain-driven design)

DDD is an approach to app design based on how the field the app is built for works, for example accounting, logistics or insurance. Eric Evans described it in his 2003 book and you'll find a summary in the DDD Reference. Its foundation is a shared language (the ubiquitous language): developers and people from the business use the same terms in conversations, in documentation and in code.

The second core concept is the bounded context. The same word can mean different things in different parts of an app: in billing, a customer is a company with a VAT ID, while in support it's a specific person who reported a problem. That's why DDD splits the app into parts with their own models and the relationships between them go into a context map.

DDD isn't the same as microservices. A bounded context can be a separate service, but it can just as well be one part of a single app. Splitting the project into domain, application and infrastructure folders isn't enough either, because without a shared language and clear boundaries, they're just folder names. A common mistake is the anemic domain model: classes carry names from the business but contain no logic and the rules are scattered elsewhere in the code. Martin Fowler considers it an anti-pattern.

The DDD approach. Developers and domain experts explore the domain together. Each bounded context has its own model and ubiquitous language. A context map records their relationships.

5. How to use TDD, BDD and DDD together

The methods complement each other and you can use them together. With DDD you define the terms, with BDD you build examples of behavior from them and the developer then writes the code against those examples using TDD. The glossary terms show up in scenario descriptions and test names, so the client recognizes them in the code too.

Take the example from this article: a credit note is a business term defined through DDD. The scenario Credit note for a returned item is an example of behavior from BDD. A test that checks the VAT calculation for a single item is a TDD unit test.

6. Which method to choose for your project

You don't have to adopt all three at once. Start with the one that solves the problem your team runs into most often.

SituationRecommendation
The app mostly stores and displays dataUse TDD for calculations and other logic. Here, DDD would add work without much benefit.
After delivery, the client often says they meant something elseIntroduce BDD and agree on examples of behavior with the client before coding.
The app has complex rules, for example for invoicing or insuranceUse DDD at least for the main part of the app and add BDD and TDD.
Older code without testsWrite new changes with TDD. Before changing old code, first write tests that capture how it behaves today. You'll find more in the article on [legacy applications](/guides/legacy-application).

7. Does TDD make sense when you build with AI?

Yes. Tests and example outputs define the expected behavior in a form you can run, which makes them useful when you build with AI too. When an AI tool writes code against tests, you verify the result by running the tests instead of reading every line of code.

The workflow is similar to working in a team. First describe the app's behavior with examples, turn them into a test list and let the AI implement them one at a time. If you don't have a development background, write the spec with a PRD template and run a smoke test after every change to the app.

8. Where to keep tests, scenarios and a glossary

All three methods produce artifacts the team keeps working with: tests and their results, scenario files, a glossary and a context map. Most of them live in the repository, where people outside development usually don't look for them.

In AboutTheApp, you can keep them right next to the app. On the app's card, use the Add link button to add the glossary and context map to the Documentation or Analysis & Planning category, the folder with scenarios and tests to the Source Code category and the CI test results to the Monitoring category. Even if everything sits in one repository, it's worth adding links to the specific places in it, so anyone can find them easily.

If you also want to describe the overall design of the app, read the article on the software design document.

AboutTheApp doesn't replace the methods

AboutTheApp doesn't run tests or design the app's model. It only stores links to the places where the team keeps tests, scenarios and the glossary, so that someone who doesn't know the repository can find them too.

Frequently asked questions

What is the difference between TDD and BDD?

TDD is a developer technique where you write a test first and then the code that passes it. BDD describes the app's behavior with examples in Given, When, Then form that testers and clients understand too. So TDD checks that the code works correctly and BDD checks that the app does what you agreed on.

Is TDD still relevant in 2026?

Yes. Tests written before the code serve as an exact spec even when AI writes the code, and they tell you when the work is done. TDD is often skipped for simple scripts and prototypes, but it pays off for logic you'll keep developing.

Is Gherkin BDD or TDD?

Gherkin is a format for writing examples of behavior in Given, When, Then form and it belongs to BDD. Tools like Cucumber can run it as an automated test, but its main purpose is a shared language between developers and the client.

What is a BDD framework?

A BDD framework is a tool that reads scenarios written in Gherkin and runs them as automated tests. For JavaScript and Java, that's Cucumber for example, for Python Behave or pytest-bdd. You don't need a framework, though: you can go through examples of behavior with the client without one.

Is DDD the same as microservices?

No. DDD deals with model design and a shared language, microservices with how the app is split up and deployed. A bounded context can be a separate service, but also just one part of a single app. Still, the contexts from DDD help you decide where to split an app into services.

Is DDD worth it for a small app?

Usually not. For an app that mostly stores and displays data, DDD would bring more work than value. It pays off for apps with complex rules and even there mainly for the part that matters most to the business.

Can you use TDD, BDD and DDD together?

Yes, they complement each other. With DDD you define the terms, with BDD you build examples of behavior from them and the developer writes tested code against those examples using TDD.

Where should I keep links to tests, scenarios and a glossary?

Ideally in one place. In AboutTheApp, you add them to the Documentation, Analysis & Planning, Source Code and Monitoring categories and have them right next to the app. Mark internal links as private and they'll only be shown to signed-in team members and people who enter the unlock code.

In short

TDD, BDD and DDD complement each other: with DDD you define shared terms, with BDD you describe the app's behavior through examples and with TDD you write tested code. Start with the method that solves your biggest problem and keep links to tests, scenarios and the glossary right next to the app.

AboutTheApp

Want tests, scenarios and docs next to your app?

Add your app to AboutTheApp for free and attach links to tests, scenarios, a glossary, the repository and environments.