BDD Style
Question
What is BDD in testing?
Hint
BDD focuses on behavior from the user perspective.
Explanation
BDD (Behavior-Driven Development) is a testing approach that uses natural language to describe behavior. The Given-When-Then structure: Given (preconditions), When (action), Then (expected outcome). Example: Given a user is logged in, When they click logout, Then they see the login page. Tools: Cucumber (Java/Ruby), Jest with describe/it (JS), Mocha. BDD bridges communication between technical and non-technical stakeholders — business analysts can read and write specs. BDD tests are often higher-level (integration/E2E). Benefits: clear requirements, living documentation, shared understanding. BDD complements TDD — TDD for units, BDD for behaviors.
Related Resources
Related Lessons
- BDD
Learn BDD.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.