21 Behavior-driven development with JUnit 5

This chapter covers

  • Analyzing the benefits and challenges of BDD
  • Moving a TDD application to BDD
  • Developing a BDD application with Cucumber and JUnit 5
  • Developing a BDD application with JBehave and JUnit 5

Some people refer to BDD as “TDD done right.” You can also think of BDD as “how we build the right thing” and TDD as “how we build the thing right.”

--Millard Ellingsworth

As we discussed in chapter 20, test-driven development (TDD) is an effective technique that uses unit tests to verify the code. Despite TDD’s clear benefits, its usual loop

[test, code, refactor, (repeat)]

can cause developers to lose the overall picture of the application’s business goals. The project may become larger and ...

Get JUnit in Action, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.