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

Sneak Peek of Java Spring Boot & Jasper — Part 1

Can A Software Developer Make As Much As A Doctor?

Manta Network Squad Game Event: Instructions on How to get on the Whitelist via Telegram Bot


Part 3 : The Before and After Phase of Content I Edited, Revised, and Proofread for Oracle’s Help…


Think headless CMS are not customizable? We disproved this using Sanity

Headless CMS

Quarantine: What to do now?

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

Chain Of Responsibility Design Pattern

Behavior parameterization (Strategy pattern) in Java

SpringBoot: Rule Engine For Classifying Celestial Objects

Why we use Java at Jibit