#Gherkin,
Wspólny język projektu
G/DEVS Lublin
Paweł
Radzikowski
21 maj, godz. 18:00, Pub u Szewca
About ME

- mentor & consultant
- devThursday keeper
Contact me:
in/paweł-radzikowski
paw.radzikowski@gmail.com

@
Paweł Radzikowski
Señor Developer @
Self-proclaimed code magician
BDD - Behavior Driven Development
Unit Tests for business processes
BDD - Behavior Driven Development
- The basis of the process is the creation of requirements
- Process description is understandable for client, analitics and programmers
- Automation

© G.Renee Guzlas



Image comes from emojidex.com


We would offer 10% discount for first orderto encourage new users

function
testGrantInitialOrderDiscount()
{...}

Discussion of acceptance criteria
Register as "Anna"
Go to "/catalog/search"
Click "Add to Cart"
[...]
- Hard to maintain
- Multiple definitions
- High entry threshold





Image comes from emojidex.com

Gherkin
Language of the project

Given the user has not ordered yet
When the user adds a book with the price of EUR 37.5 into the shopping cart
Then the shopping cart sub-total is EUR 33.75
Gherkin
- Non-technical language for business
- Describe system behaviour
- Bridge between business and programmer
Story Syntax
- Tittle
- Narration
- Acceptance criteria
Feature: Listing command
In order to change the structure of the folder I am currently in
As a UNIX user
I need to be able see the currently available files and folders there.
I need privileges to delete files
I can delete files
Scenario: Listing two files in a directory
Given I am in a directory "test"
And I have a file named "foo"
And I have a file named "bar"
When I run "ls"
Then I should get:
"""
bar
foo
"""
Scenario: Permission denied durring delete fiele
Given I am in a directory "test"
And My user is Paweł
And My group is developer
And There is a file named "foo"
And The file have access attribute 770
And The file have ownership attribute Łukasz:PM
When I run "rm foo"
Then I should get:
"""
Access Denied
"""
Narration
- Describe feature (what to do)
- Describe who is user
- Describe what is the advantage
Feature: Listing command
In order to change the structure of the folder I am currently in
As a UNIX user
I need to be able see the currently available files and folders there
Scenario: Listing two files in a directoryAcceptance Criteria
- Given - describe the initial conditions
(descibe an actor state) - When - describe actions (what actor do)
- Then - describe awaiting results
(what actor see/have)
Given I am in a directory "test"
And I have a file named "foo"
And I have a file named "bar"
When I run "ls"
Then I should get:
"""
bar
foo
"""The feature scenario
Story- Building steps
- Step should be generic
- Step should be understable
- Step should contain information about what to do
- Step should be written in correct English
- Steps should be consistent with each other (the way of building sentences)
Pros
For All:
- living documentation
- collaboration, early discovery of unknowns
- enforce building domain vocabulary and semi formal language (DSL) to express system behaviour consistently within the organization.
Pros
For devs:
- like TDD, it helps to think in chunks, create nice and testable code.
- write code for what is needed only (build the right thing)
- better coordination between different dev teams developing similar features with different technologies.
Pros
For QA:
- ready acceptance criteria
- ready building blocks for all kind of tests
- test what is exactly need (test the right thing)
Pros
For Product Owner:
- think and reason features in detail thus produce better specification
- better visual and coordination with other Managers and Product owners
- better visual and understanding on Devs and QAs output/report due to the same source/format of specs
Cons?
- Team can consider it as a waste of time
- Anticipation by developers the concept of "Testing"
- The test can be targeted on verification of classes and methods and not on what the code really should do
Q&A ?
Gherkin: a language of the project
By Paweł Radzikowski
Gherkin: a language of the project
- 813