BDD - a test-first development approach
Just like TDD, BDD also insists on following a test-first development approach. Hence, in this section, let's explore how we could write an end-to-end feature following a test-first development approach the BDD way!
Let's take a simple example that helps us understand the BDD style of coding. We will write an RPNCalculator
application that does addition, subtraction, multiplication, division, and complex math expressions that involve many math operations in the same input.
Let's create our project folder structure as per Cucumber standards:
mkdir RPNCalculator cd RPNCalculator cucumber --init tree mkdir src tree
The following screenshot demonstrates the procedure visually:
Great! The folder structure is now created. Now, let's create empty files with a touch utility to help us visualize our final project folder structure along with the files:
touch features/rpncalculator.feature touch features/step_definitions/RPNCalculatorSteps.cpp touch features/step_definitions...