- What does BDD stand for?
- Behaviour-driven development. It is a way of working, not a tool: the team agrees on concrete examples of how a feature should behave before it is built, writes those examples down in language everyone shares, and then makes them executable. Dan North named it in 2006 after noticing that teams taught test-driven development got stuck on the word "test".
- Is BDD the same thing as Cucumber?
- No. Cucumber is one tool that runs Gherkin scenarios; BDD is the practice of discovering and agreeing those scenarios in the first place. A team can use Cucumber and not do BDD — that is the common case, and it usually means the scenarios were written after the code by one person, which buys an extra layer of indirection and no shared understanding. A team can also do BDD with no Gherkin at all.
- Do I have to write Gherkin to do BDD?
- No. Gherkin is a convenient format for the formulation step because it is readable by a product owner and parseable by a runner, but the value comes from the conversation that produces the examples. Plenty of teams do the discovery work, capture the examples in a wiki or a ticket, and automate them as ordinary tests. What you lose is the direct link between the sentence the business agreed to and the test that proves it.
- Is BDD replacing TDD?
- No, it grew out of it and sits above it. BDD scenarios describe user-visible behaviour, so a suite made only of them is slow and tells you only coarsely where something broke. Real systems need far more low-level tests than they have scenarios. Eric Elliott puts the split well: functional tests help you build the right product, unit tests help you build the product right.
- Who writes the feature files?
- The examples come from a conversation between the person who wants the feature, the person who will build it, and the person whose job is to break it — the "three amigos". Someone then writes them up, usually a tester or a developer. The test of whether it worked is not who typed it but whether the person who asked for the feature can read the result and say whether it is right.
- How many scenarios should a feature file have?
- Few enough that someone can read the file and understand the capability. If a file runs past roughly ten scenarios it is usually describing more than one capability, or it has started documenting data variations that belong in a Scenario Outline or in unit tests. A feature file is a specification a person reads, not a test-case inventory.
- Does BDD work if the business will not get involved?
- Partly, and you should be honest about which part. You keep the readable regression suite and the living documentation. You lose the discovery benefit, which is the one that pays for the rest — the whole argument for BDD is that catching a misunderstanding in a twenty-five minute conversation is cheaper than catching it in code review. Without that, plain unit and integration tests are usually the better trade.
- What is the difference between a Scenario and a Scenario Outline?
- A Scenario is one concrete example with fixed values. A Scenario Outline is the same scenario parameterised by placeholders in angle brackets, run once per row of its Examples table. Use an outline when the same behaviour is genuinely being illustrated at several boundaries; do not use it to run one path against thirty rows of data, which is a unit test wearing a costume.