![Page 1: Behaviour Driven Development with Cucumber · 2017-12-06 · Behaviour Driven Development A way to describe the requirement such that everyone the business folks, the developer, the](https://reader035.vdocument.in/reader035/viewer/2022070706/5e98beaffb640868d642ac7a/html5/thumbnails/1.jpg)
Behaviour Driven Development
with Cucumber
![Page 2: Behaviour Driven Development with Cucumber · 2017-12-06 · Behaviour Driven Development A way to describe the requirement such that everyone the business folks, the developer, the](https://reader035.vdocument.in/reader035/viewer/2022070706/5e98beaffb640868d642ac7a/html5/thumbnails/2.jpg)
2 04.07.2012
Introduction
![Page 3: Behaviour Driven Development with Cucumber · 2017-12-06 · Behaviour Driven Development A way to describe the requirement such that everyone the business folks, the developer, the](https://reader035.vdocument.in/reader035/viewer/2022070706/5e98beaffb640868d642ac7a/html5/thumbnails/3.jpg)
Sapir–Whorf Hypothesis
3 04.07.2012
People who speak different languages
perceive and think about the world quite
differently.
![Page 4: Behaviour Driven Development with Cucumber · 2017-12-06 · Behaviour Driven Development A way to describe the requirement such that everyone the business folks, the developer, the](https://reader035.vdocument.in/reader035/viewer/2022070706/5e98beaffb640868d642ac7a/html5/thumbnails/4.jpg)
Behaviour Driven Development
A way to describe the requirement such that everyone
the business folks,
the developer,
the tester
and others
has a common understanding of the scope of work.
A description of a requirement and its business benefit, and a set of criteria by which
we all agree that it is “done”.
4 04.07.2012
![Page 5: Behaviour Driven Development with Cucumber · 2017-12-06 · Behaviour Driven Development A way to describe the requirement such that everyone the business folks, the developer, the](https://reader035.vdocument.in/reader035/viewer/2022070706/5e98beaffb640868d642ac7a/html5/thumbnails/5.jpg)
Introduction
The workflow
Developer and stakeholder collaborate to write automated tests.
Software is accepted if automated tests pass.
Automated acceptance tests as …
ubiquitious language for everybody
a means of collaboration and discussion
living documentation
5 04.07.2012
![Page 6: Behaviour Driven Development with Cucumber · 2017-12-06 · Behaviour Driven Development A way to describe the requirement such that everyone the business folks, the developer, the](https://reader035.vdocument.in/reader035/viewer/2022070706/5e98beaffb640868d642ac7a/html5/thumbnails/6.jpg)
Example taken from Relish
6 04.07.2012
![Page 7: Behaviour Driven Development with Cucumber · 2017-12-06 · Behaviour Driven Development A way to describe the requirement such that everyone the business folks, the developer, the](https://reader035.vdocument.in/reader035/viewer/2022070706/5e98beaffb640868d642ac7a/html5/thumbnails/7.jpg)
Describe Features in the Gherkin Language
Feature
Requirements are descriped as Features
A feature contains many Scenarios.
Scenario
Desired behaviour is described as Scenario.
All scenarios follow the same pattern:
1. Get the system into a particular state.
2. Poke it (or tickle it, or ...).
3. Examine the new state.
Those three parts are identified by the following keywords
Scenario: Successful withdrawal from an account in credit
Given I have $100 in my account # the context
When I request $20 # the event(s)
Then $20 should be dispensed # the outcome(s)
7 04.07.2012
![Page 8: Behaviour Driven Development with Cucumber · 2017-12-06 · Behaviour Driven Development A way to describe the requirement such that everyone the business folks, the developer, the](https://reader035.vdocument.in/reader035/viewer/2022070706/5e98beaffb640868d642ac7a/html5/thumbnails/8.jpg)
Cucumber Testing Stack
8 04.07.2012
![Page 9: Behaviour Driven Development with Cucumber · 2017-12-06 · Behaviour Driven Development A way to describe the requirement such that everyone the business folks, the developer, the](https://reader035.vdocument.in/reader035/viewer/2022070706/5e98beaffb640868d642ac7a/html5/thumbnails/9.jpg)
9 04.07.2012
BDD in CPM
![Page 10: Behaviour Driven Development with Cucumber · 2017-12-06 · Behaviour Driven Development A way to describe the requirement such that everyone the business folks, the developer, the](https://reader035.vdocument.in/reader035/viewer/2022070706/5e98beaffb640868d642ac7a/html5/thumbnails/10.jpg)
Motivation
How can we document the fullfillment of a regulation to external revision?
For that we need
easy readable documentation for requirements and tests
reports on what has been tested and when
10 04.07.2012
![Page 11: Behaviour Driven Development with Cucumber · 2017-12-06 · Behaviour Driven Development A way to describe the requirement such that everyone the business folks, the developer, the](https://reader035.vdocument.in/reader035/viewer/2022070706/5e98beaffb640868d642ac7a/html5/thumbnails/11.jpg)
BDD in CPM
Spike with BDD to test Conflict Minerals Regulation.
CPM Admin Console developed with BDD
11 04.07.2012
![Page 12: Behaviour Driven Development with Cucumber · 2017-12-06 · Behaviour Driven Development A way to describe the requirement such that everyone the business folks, the developer, the](https://reader035.vdocument.in/reader035/viewer/2022070706/5e98beaffb640868d642ac7a/html5/thumbnails/12.jpg)
Example CPM Admin Console
Defining the Features
Running the Features
Documenting the Features.
12 04.07.2012
![Page 13: Behaviour Driven Development with Cucumber · 2017-12-06 · Behaviour Driven Development A way to describe the requirement such that everyone the business folks, the developer, the](https://reader035.vdocument.in/reader035/viewer/2022070706/5e98beaffb640868d642ac7a/html5/thumbnails/13.jpg)
Example CPM Admin Console
Define the Feature Health Check
Feature: Check Health of CPM Server
Scenario: Health check is successful if the server is available.
Given The server is <available>.
When I run the admin console with arguments `-c`
Then the output contains "up and running".
Scenario: Health check fails if the server is not available.
Given The server is <not available>.
When I run the admin console with arguments `-c`
Then the output contains "not available".
Scenario: Health check uses default url if the server is not specified.
Given The server is <not specified>.
When I run the admin console with arguments `-c`
Then the output contains "not available".
And the output contains "http://localhost:8080/cpm".
13 04.07.2012
![Page 14: Behaviour Driven Development with Cucumber · 2017-12-06 · Behaviour Driven Development A way to describe the requirement such that everyone the business folks, the developer, the](https://reader035.vdocument.in/reader035/viewer/2022070706/5e98beaffb640868d642ac7a/html5/thumbnails/14.jpg)
Example CPM Admin Console
Defining the Features
Each Features is defined in its own file e.h. argumentValdiation.feature
Feature files are under source control (in Github).
14 04.07.2012
![Page 15: Behaviour Driven Development with Cucumber · 2017-12-06 · Behaviour Driven Development A way to describe the requirement such that everyone the business folks, the developer, the](https://reader035.vdocument.in/reader035/viewer/2022070706/5e98beaffb640868d642ac7a/html5/thumbnails/15.jpg)
Example Admin Console
Running the Features
Developers run the Features in their IDE during development
15 04.07.2012
![Page 16: Behaviour Driven Development with Cucumber · 2017-12-06 · Behaviour Driven Development A way to describe the requirement such that everyone the business folks, the developer, the](https://reader035.vdocument.in/reader035/viewer/2022070706/5e98beaffb640868d642ac7a/html5/thumbnails/16.jpg)
Example Admin Console
Running the Features
Features are executed automatically during every build in Jenkins
16 04.07.2012
![Page 17: Behaviour Driven Development with Cucumber · 2017-12-06 · Behaviour Driven Development A way to describe the requirement such that everyone the business folks, the developer, the](https://reader035.vdocument.in/reader035/viewer/2022070706/5e98beaffb640868d642ac7a/html5/thumbnails/17.jpg)
Example Admin Console
Documenting the Features
Report for the features is generated during the build
17 04.07.2012
![Page 18: Behaviour Driven Development with Cucumber · 2017-12-06 · Behaviour Driven Development A way to describe the requirement such that everyone the business folks, the developer, the](https://reader035.vdocument.in/reader035/viewer/2022070706/5e98beaffb640868d642ac7a/html5/thumbnails/18.jpg)
18 04.07.2012
Questions