Behavior Driven Development with JUnit 5. Part 6

  • We annotate the class with @RunWith(Cucumber.class) #1. Executing it like any JUnit test class runs all the features found on the classpath in the same package. As there is no Cucumber JUnit 5 extension at the moment of writing this chapter, we use the JUnit 4 runner.
  • The @CucumberOptions annotation #2 provides the plugin option #3 that is used to specify different formatting options for the output reports. Using “pretty”, the Gherkin source is printed with additional colors (figure 7). Other plugin options include “html” and “json”, but “pretty” is appropriate for now. And the features option #4 helps Cucumber locate the feature file in the project folder structure. It looks for the features folder on the classpath — and remember that the src/test/resources folder is maintained by Maven on the classpath!


  • Introducing BDD, a software development technique that encourages teams to deliver software that matters and supports cooperation between stakeholders
  • Analyzing the benefits of BDD: addressing user needs, clarity, change support, automation support, focus on adding business value, and cost reduction
  • Analyzing the challenges of BDD: it requires engagement and strong collaboration, interaction, direct communication, and constant feedback
  • Moving a TDD application to BDD with the help of Cucumber by creating a separate feature, generating the skeleton of the testing code, writing the tests, and implementing the code

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How is Cloud Computing Technology Beneficial For Mobile App Development in Saudi Arabia?

How Much does it Cost to Build an App like Zomato : Aalpha

21 days of Code with Code Warriors — Day 6

Do more with your data with these Google Sheets Add-Ons

All The Linux You Need To: Update a Cardano Node

Serverless Lambda Function AWS

Quiz | Computer Fundamentals | Set 17

Soft focus and enhanced lighting in Teams video meetings

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Luxoft Training

Luxoft Training

More from Medium

Why Java is platform independent

What is the difference between Encoding, Encryption, Hashing?

Good practise to use Equals and Hashcode Method in Hibernate

S.O.L.I.D Principles