Upload
kamil-nicieja
View
251
Download
1
Embed Size (px)
Citation preview
Specifications for the real world Specification by Example and Gherkin
Kamil Nicieja [email protected]
Kamil Nicieja
1. a product manager
2. co-founder & CEO at Ada
http://www.adaonline.pl
3. author of “Writing Great Specifications”
Specifica.on is
1. a document
2. which contains requirements
3. and so is created as a result of the analysis phase
4. only to expire quickly after production release
Why care?
An analysis issued by Great Britain's Health and Safety Executive suggests that
44% of system failures may have their root cause in an inadequate
specification.
Bell Labs and IBM studies have determined that 80% of all defects are
inserted in the requirements phase.
Why care?
An analysis issued by Great Britain's Health and Safety Executive suggests that
44% of system failures may have their root cause in an inadequate
specification.
Bell Labs and IBM studies have determined that 80% of all defects are
inserted in the requirements phase.
Commercial organizations across the European Union lost 142 billion EUR on
failed IT projects in 2004 alone, mostly because of poor alignment with
business objectives or business strategies becoming obsolete during delivery.
Why care?
We’re doing something wrong.
Specification anti-patterns
Specification anti-patterns
Over-specification
Specification anti-patterns
Over-specification Hand-offs
Specification anti-patterns
Over-specification Hand-offs
Speci-fiction
Specification anti-patterns
Over-specification Hand-offs
Under-documentationSpeci-fiction
Specifica.on is
1. a document
2. which contains requirements
3. and so is created as a result of the analysis phase
4. only to expire quickly after production release
Specifica.on is
1. a document communication process
2. which contains requirements
3. and so is created as a result of the analysis phase
4. only to expire quickly after production release
Specifica.on is
1. a document communication process
2. which contains requirements
3. and so is created as a result of the analysis phase
4. only to expire quickly after production release
“Organiza2ons which design systems are constrained to
produce designs which are copies of the communica2on
structures of these organiza2ons.”
—Melvin Conway
Specifica.on is
1. a document communication process
2. which contains requirements
3. and so is created as a result of the analysis phase
4. only to expire quickly after production release
Specifica.on is
1. a document communication process
2. which contains evolves requirements
3. and so is created as a result of the analysis phase
4. only to expire quickly after production release
Specifica.on is
1. a document communication process
2. which contains requirements
3. and so is created as a result of the analysis phase
4. only to expire quickly after production release
“A complex system that works is invariably found to have
evolved from a simple system that worked. A complex system
designed from scratch never works and cannot be patched up
to make it work. You have to start over with a working simple
system.”
—John Gall
Specifica.on is
1. a document communication process
2. which contains evolves requirements
3. and so is created as a result of the analysis phase
4. only to expire quickly after production release
Specifica.on is
1. a document communication process
2. which contains evolves requirements
3. and so is created as a result of the analysis phase
4. only to expire quickly after production release
Specifica.on is
1. a document communication process
2. which contains evolves requirements
3. and so is created as a result of the analysis phase
4. only to expire quickly and continues after production release
Specifica.on is
1. a document communication process
2. which contains evolves requirements
3. and so is created as a result of the analysis phase
4. only to expire quickly and continues after production release
5. with short, concrete, and easy to maintain documentation
Meet Specifica.on by Example and Gherkin
Meet Specifica.on by Example and Gherkin
Having conversations about
requirements
Meet Specifica.on by Example and Gherkin
Having conversations about
requirements
Writing acceptance tests for
requirements
Having conversations about
requirements
Capturing conversations in
Gherkin
Writing acceptance tests for
requirements
Meet Specifica.on by Example and Gherkin
Given Mike, a member of our team
And that it isn't 2 PM yet
When Mike chooses 2 PM as a start time for his meeting
Then he should be able to save his meeting
Capturing conversations in Gherkin
Gherkin specifications are written through scenarios. Analysts, designers,
programmers, and testers can all write the scenarios.
Given(/^Mike, a member of our team$/) do
@mike = User.new
@mike.save(name: "Mike")
end
Given(/^that it isn't (\d+) PM yet$/) do |arg1|
# We subtract 1 from arg1 because we need to make sure
# that time is frozen before arg1
Timecop.freeze Time.parse("January 1st, 2016 #{arg1.to_i - 1} PM")
end
When(/^Mike chooses (\d+) PM as a start time for his meeting$/) do |arg1|
time = Time.parse("January 1st, 2016 #{arg1} PM")
@meeting = Meeting.new
@meeting.save(start_time: time)
@mike.meetings << @meeting
end
Then(/^he should be able to save his meeting$/) do
expect(@mike.meetings.first.saved?).to eq true
end
Gherkin scenarios can even be
automated by developers and
testers.
Automated acceptance tests make
sure that the specs stay up to date.
Ability: Screening tenant leads
SCREENING is the process of evaluating a tenant lead before
signing a lease in order to choose the best candidate.
A TENANT LEAD is a potential tenant who applied to live in
an apartment managed by our rental platform.
Scenario Outline: Screening leads based on credit score
TENANTS PIPELINE is a list of verified tenant
leads a landlord can choose from.
Given a tenant lead:
| name | credit used | total debt |
| Simona Jenkins | <used> | <debt> |
And that the lead waits in the queue to the tenants pipeline
When the tenant lead has a <score>
Then we should <result> the lead to the tenants pipeline
Examples:
| used | debt | score | result |
| 40% | $202,704 | credit score of 499 | reject |
| 41% | $202,704 | credit score of 500 | accept |
Some Gherkin specifications can be
quite complex and use tables or
dynamic attributes.
Ability: Screening tenant leads
SCREENING is the process of evaluating a tenant lead before
signing a lease in order to choose the best candidate.
[...]
Func.onal requirements
Business Need: Security
Scenario: Activating two-factor authentication
[...]
Non-func.onal requirements
The specification suite creates
an up-to-date map of
requirements.
Long-term benefits
1. Better requirements
2. Less rework
3. Business-readable acceptance tests
4. Living documentation
“Writing Great Specifications” Using Specification by Example and Gherkin by Kamil Nicieja
Use code nicebamu to get a 39% discount on manning.com