Writing our first Cucumber test case
Let's write our very first Cucumber test case! As this is our first exercise, I would like to keep it short and simple. First, let's create the folder structure for our HelloBDD
project.
To create the Cucumber project folder structure, we can use the cucumber
utility, as follows:
cucumber --init
This will ensure that the features
and steps_definitions
folders are created as per Cucumber best practices:
Once the basic folder structure is created, let's manually create the rest of the files:
mkdir src cd HelloBDD touch CMakeLists.txt touch features/hello.feature touch features/step_definitions/cucumber.wire touch features/step_definitions/HelloBDDSteps.cpp touch src/Hello.h touch src/Hello.cpp
Once the folder structure and empty files are created, the project folder structure should look like the following screenshot:
It's time to start applying our Gherkin knowledge in action; hence, let's first start with the feature file:
# language: en Feature: Application...