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

Post on 14-Apr-2020

2 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

Transcript

Behaviour Driven Development

with Cucumber

2 04.07.2012

Introduction

Sapir–Whorf Hypothesis

3 04.07.2012

People who speak different languages

perceive and think about the world quite

differently.

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

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

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

Cucumber Testing Stack

8 04.07.2012

9 04.07.2012

BDD in CPM

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

BDD in CPM

Spike with BDD to test Conflict Minerals Regulation.

CPM Admin Console developed with BDD

11 04.07.2012

Example CPM Admin Console

Defining the Features

Running the Features

Documenting the Features.

12 04.07.2012

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

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

Example Admin Console

Running the Features

Developers run the Features in their IDE during development

15 04.07.2012

Example Admin Console

Running the Features

Features are executed automatically during every build in Jenkins

16 04.07.2012

Example Admin Console

Documenting the Features

Report for the features is generated during the build

17 04.07.2012

18 04.07.2012

Questions

top related