25
Specification by example Andrey Grave

Specification-by-example Workshop at LatCraft

Embed Size (px)

Citation preview

Specification by example

Andrey Grave

About me- 15 years in software development- Various roles - Pl/SQL dev, System analyst, Java developer, Team lead ...- Various companies - government, outsourcing, product, startup

Agenda● Intro into Specification by example● Exercise● Some more info● Exercise● Some more info● Wrap up

Specification by example

“Specification by Example is a set of process patterns that facilitate change in software products to ensure that the right

product is delivered efficiently.” Gojko Adzic

Why? Advantages of specification by example● Increased quality● Reduced waste● Reduced risk of production defects● Focused effort● Changes can be made more safely● Improved business involvement● Shared understanding

Specification by example - key process patterns

Our today focus● Illustrate using examples● Specify collaboratively● Refining specification

Why examples?● easier to understand● harder to misinterpret● we already use them

For exampleImagine we are building affiliate management solution and we have following requirement:

“Pay 2 EUR per 1000 clicks”

Group exerciseImagine You are working in a internet Amazon, and Jeff Bezos comes up to You and gives You following user story:

“Hey, I want provide free delivery on books for our VIP customers”

Key example● Outside-in● Start with output● Avoid making up your own data (ask customers instead)● Look for implied concepts● Examples should be easy to understand

Validating examples● Use questions:

○ Complicated edge cases○ Open ended questions (not yes/no)○ Experiment with data

● Feedback exercise

Specification workshops● Collaboration models

○ All team workshop○ Three amigos○ Pairing○ … other

● Invite stakeholder (someone who controls money, and can make decisions)

Coming up with examples● Happy path● Edge cases● Every acceptance criteria should have at least one example● Play with outcomes● Play with context● It’s about examples You don’t know, not ones You know

GherkinGIVEN - Context

And [more context]

WHEN - action

And [other action]

THEN - outcome

And [more outcome]

ScenarioFeature: Search feature for users

This feature is very important because it will allow users to filter products

Scenario: When a user searches, without spelling mistake, for a product name present in inventory. All the products with similar name should be displayed

Given User is on the main page of www.myshopingsite.com

When User searches for laptops

Then search page should be updated with the lists of laptops

Scenario outline

Free delivery VIP

Good specifications ● Use Domain language● Tangible, not abstract● Explicit, not implicit● Human readable● Avoid GUI specifics

Life after workshop● Automate

○ Try preserve business language○ Plan up-front to automate ○ Treat automation code as first class citizen

● Validate frequently○ Include in CI○ Consider having an “sprint” test pack (valuable to show progress)

● Living documentation○ Keep specifications as simple and short as possible○ Organize specifications (by functionality)○ Evolve specifications ○ Make documentation accessible (Relish docs)

Tool overview

CONCORDION

Robot Framework

Tool overview

CEDAR

RoboSpock

Summary● Focus on collaboration and communication● Don’t jump to implementation details● Seek for missing business concepts● Try it out!

“Having a conversation

is more important than

recording the conversation

is more important than

automating the conversation”

Liz Koegh

Book recommendations