Download - Cukeup nyc richard lawrence on getting the language right

Transcript
Page 1: Cukeup nyc richard lawrence on getting the language right

Getting the Language Right with Cucumber

Richard Lawrence, Agile For All

Page 2: Cukeup nyc richard lawrence on getting the language right
Page 3: Cukeup nyc richard lawrence on getting the language right

Varieties of Language in

Cucumber Scenarios

Page 4: Cukeup nyc richard lawrence on getting the language right

Tautological

Scenario: Search for a Book When I search for a book Then I should see the correct results

Page 5: Cukeup nyc richard lawrence on getting the language right

Scenario: Search for a book Given the following Authors: | id | name | | 1 | Charles Dickens | | 2 | John Steinbeck | | 3 | Fyodor Dostoyevsky | And the following Titles: | id | title | author_id | | 1 | A Tale of Two Cities | 1 | | 2 | Crime and Punishment | 3 | | 3 | East of Eden | 2 | And I'm on "http://www.bookstore.biz/" When I fill in "Dickens" in "//input[name()='q']" And I click "#searchButton" Then there should be 1 "div.book div.title" element And the page should contain "A Tale of Two Cities"

Super Technical

Page 6: Cukeup nyc richard lawrence on getting the language right

Scenario: Search for a book Given the following catalog: | Title | Author | | A Tale of Two Cities | Charles Dickens | | Crime and Punishment | Fyodor Dostoyevsky | | East of Eden | John Steinbeck | And I'm on the bookstore home page When I fill in "Dickens" in the search field And I click "Search" Then I should see only "A Tale of Two Cities" in the results

Scripty, with Implementation Details

Page 7: Cukeup nyc richard lawrence on getting the language right

Scenario: Search for a book Given the following catalog: | Title | Author | | A Tale of Two Cities | Charles Dickens | | Crime and Punishment | Fyodor Dostoyevsky | | East of Eden | John Steinbeck | When I search for "Dickens" Then I should see only "A Tale of Two Cities" in the results

Example in Domain Language

Page 8: Cukeup nyc richard lawrence on getting the language right

Example in Domain Languagewith Excess Detail

Scenario: Search for a book Given the following catalog: | Title | Author | Publisher | ISBN | | A Tale of Two Cities | Charles Dickens | Qualitas Classics | 1897093594 | | Crime and Punishment | Fyodor Dostoyevsky | Simon & Brown | 1936041030 | | East of Eden | John Steinbeck | Penguin | 0142000655 | When I search for "Dickens" Then I should see only the following in the results: | Title | Author | Format | Price | | A Tale of Two Cities | Charles Dickens | Paperback | $14.90 |

Page 9: Cukeup nyc richard lawrence on getting the language right

Different Kinds of ScenariosTa

utologica

lDomain

Languag

e Example

Domain La

nguage Exa

mple

w/ Exc

essive

Detai

l

Implementat

ion Languag

e

(Probab

ly Scri

pty)Super

Tech

nical

Sweet Spot

Page 10: Cukeup nyc richard lawrence on getting the language right

Identify different kinds

of scenarios

Exercise

Page 11: Cukeup nyc richard lawrence on getting the language right

Different Kinds of ScenariosTa

utologica

lDomain

Languag

e Example

Domain La

nguage Exa

mple

w/ Exc

essive

Detai

l

Implementat

ion Languag

e

(Probab

ly Scri

pty)Super

Tech

nical

Sweet Spot

Page 12: Cukeup nyc richard lawrence on getting the language right

Questions?

Email: [email protected]: @rslawrence

Blog: richardlawrence.info