Professional Documents
Culture Documents
with Gherkin
FROM STAKEHOLDER EXAMPLES TO LIVING DOCUMENTATION
Vienna/Austria
How do we specify
requirements?
3
Discovering what matters to customers
Why?
Impact Mapping
Impact, Goal
Isolated,
Capability Story Mapping formalized
example
Feature
Epic
User Story
Reminder
Acceptance for a Bug
Criterion discussion report
Specification-By-Example
Code
How?
Easier to define upfront Harder to define upfront
5
Collecting Acceptance Criteria
As a potential customer Imagine this story is
I want to collect books in a shopping cart already implemented:
So that I can order several books at once. how would you verify it?
7
Examples for user stories
UI wire frames,
existing UI
8
As a potential customer
However
examples are usually not formally Brian Marick
exchanged or documented
consist of
Examples Tests
describe verify
fulfillment of
Requirements
10
Discussion of acceptance criteria
We would like to encourage new users to
buy in our shop.
Therefore we offer 10% discount for their
first order.
As a shop visitor
I want to collect books in my shopping basket
so that I can purchase multiple books at once.
15
Examples for acceptance criteria
As a shop visitor
I want to collect books in my shopping basket
so that I can purchase multiple books at once.
16
Examples for acceptance criteria
As a shop visitor
I want to collect books in my shopping basket
so that I can purchase multiple books at once.
17
Structure of examples
Title: Describes intention/abstract acceptance criterion
Arrange: Context, initial state of the system Triple-A
Act: Execution of the feature constraint
Checks
Assert: Assertion of observable behaviour
The same book can be added multiple times to the shopping basket
Given my shopping basket contains 1 copy of Harry Potter
Chaining
up steps
18
Exercise
Work in same previous groups of 2-3
Pick an acceptance criteria from the
previously compiled list
Illustrate with examples formalized into
Given: Context, initial state
When: utilization of the feature
Then: assertions of observable behaviour
Validate that scenario title (acceptance
criterion) still describes intention of
formalized scenario
19
How long do we
care
about the
examples?
20
Purpose of the examples
Shared understanding:
acceptance criteria
Documentation:
Look-up detail aspects
of the system
Regression-tests:
Understand what
assumptions have been violated
21
Continuous validation with automation
Step Definitions are binding individual steps
to an automatable interface of the application.
Automation does not necessarily have to bind to the UI.
UI
System
Automation
Automatable
interface
22
Demo
http://www.specflow.org
23
What does that
mean for
testing?
24
UI automation becomes expensive
when
trying to automate
structure
manual tests
making tests
unreadable when readability
automating them
automating after
completing point in time
development
25
Structure
Manual tests Automated Check
26
Test automation pyramid
few
exploratory hard
testing
User
Automatability
journeys
Acceptance-
criteria
Units
easy
many
27
Source: Mike Cohn
Readability
// Go to web page 'http://localhost:40001/' using new browser instance
BrowserWindow localhostBrowser = BrowserWindow.Launch(
new System.Uri(this.RecordedMethod1Params.Url));
Assert.IsTrue(fundNr1 + 1 == fundNr2);
28
A readable test case
Scenario: New found items should receive a
consecutive number for the current year
technical view
Agile Testing Quadrants: Brian Marick
30
Cross-functional teams
Co-creation
Fast feedback
31
Cross-functional work
Limit Collaboration for defining Extension of Collaboration for
WIP acceptance criteria Test Cases automation
US1
Plan
Implement & US4 US7
Exploratory Tests
autom. test US5 US8
Plan Plan
US6
Plan US9
Plan
Collaboration
US2 ImplementPlan& ImplementPlan&
in manual US3 autom. test &
Implement autom. test &
Implement
testing Plan autom. test &
Implement autom. test &
Implement
Plan autom. test
Implement & autom. test
Implement
autom. test &
autom. test Specification and test
Preventing bugs
short iteration
instead of finding them!
32
What does that
mean for
development?
33
Workflow - TDD
34
Extending TDD for business
35
Transparency for stakeholders
In Progress
36
Current sprint report: all sprint scenarios
37
Starting with first scenario (AC)
38
Finishing the first scenario (AC)
39
Progressing scenario after scenario
40
Progressing scenario after scenario
41
Progressing scenario after scenario
42
Implementing user stories in parallel
43
First user story ready for testing
44
Manual testing can start even earlier
45
Already done work can break again
46
Already done work can break again
47
See what is temporarily not working
48
Living
documentation
50
Story Maps
Developed by Jeff Patton
Skeleton for fine-grained user stories
Built for a set of capabilities or outcome
that the system should support
51
Building story maps
Book delivered desired effect
to my home or outcome
time
browse receive receive
put into enter system
best delivery delivery
basket address features
necessity
52
Establish a walking skeleton
Book delivered
to my home
time
browse omitted receive
manual enter Walking
best workaround steps delivery
address skeleton
necessity
sellers slip
search pay with inquiry
create receive
book by putlist
into credit order
wish delivery
title basket card status
notificat.
53
Demo
Story Maps as Living Documentation
54
User Stories vs. Features
Product/Sprint Backlog Living Documentation
AccCrit 1 AccCrit 1
User Story 1
AccCrit 2 Done Feature 1
AccCrit 2
AccCrit 3 AccCrit 3
User Story 2
AccCrit 4 AccCrit 5
AccCrit 5 AccCrit 4
User Story n Feature n
AccCrit m AccCrit m
55
Demo
Feature Tree as Living documentation
56
Additional
thoughts
57
Level of automation
Out-of-process Browser
automation
In-process
Assert behaviour Trigger behaviour
View on model, db, .. through controller
Model
Controller
Setup pre-conditions
Business Layer through service
interfaces
Data Layer
58
Performance
Grouping tests
Current WIP
Completed work
Database
In-memory
Templates for setup
Parallel execution
Smart execution order
59
Internal vs. external DSL
Example Source:
Liz Keogh
https://github.com/lunivore/tictactoe-java/blob/master/
scenarios/com/lunivore/tictactoe/scenarios/
Three_in_a_row_wins.java
60
Non-functional acceptance criteria
Given there are 100,000 users registered on the system
When I create a new account
Then I should be taken to my dashboard within 5ms
Matt Wynne
http://blog.mattwynne.net/2012/03/13/using-cucumber-for-load-testing
61
Tools
62
Gherkin automation tools
PHP
www.behat.org
63
64
Books
65
66
Christian Hassa: ch@techtalk.at - @chr99ha