Cucumber BDD (Part 2): Creating a Sample Java Project with Cucumber, TestNG, and Maven

Thilina Ashen Gamage
Agile Vision
Published in
8 min readJul 10, 2017

--

Disclaimer: This is an extension to my previous tutorials: Behavior Driven Development (BDD) & Software Testing in Agile Environments and Cucumber BDD (Part 1): Starting with Feature Mapping. In this tutorial, we are gonna build a sample Java project with Cucumber, TestNG, and Maven for the better understanding of concepts studied in the first two tutorials.

Also I have implemented the steps discussed in this blog post series here: https://github.com/ashenwgt/awesome-bdd-with-cucumber. You can clone this project, modify my code, and start writing your test suite on top of it.

Introducing BDD Gear

Before getting started with BDD style, the following tools need to be set up in the development environment.

  • BDD Test Framework — to define application behaviour in plain meaningful English text using a simple grammar defined by a domain-specific language (DSL)– e.g. Cucumber (DSL: Gherkin), JBehave (DSL: Gherkin), Behat (DSL: Gherkin), Mocha (DSL: user-defined)
  • Test Runner — to automate and run the behaviour tests– e.g. TestNG (Java), jUnit (Java), Mocha (JavaScript)
  • Optional IDE plugins — to enable BDD coding support in IDEs– e.g. Cucumber plugin for IntelliJ IDEA and Eclipse IDEs

Setting Up Development Environment

Step 1: Create a Maven Project

--

--

Thilina Ashen Gamage
Agile Vision

Advocate of Cloud, Microservices, & Clean Code | 1.5M+ Reach | For more exciting content, stay in touch: https://medium.com/@ThilinaAshenGamage