Cucumber BDD (Part 2): Creating a Sample Java Project with Cucumber, TestNG, and Maven
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