user acceptance testing driven by humans telling stories (with rspec)

Download User Acceptance Testing Driven by Humans telling Stories (with RSpec)

If you can't read please download the document

Upload: jean-michel-garnier

Post on 16-Apr-2017

3.139 views

Category:

Technology


0 download

TRANSCRIPT

http://citconf.com/amsterdam2008/

User Acceptance TestingDriven by Humanstelling Stories (with RSpec)

Jean-Michel Garnier | 21croissants.com

Ruby on Railsweb appQA

$sel.click('foo')wait_for('x$%')The user wants something for sure but I have no clue if developpers canimplement it or not...

User storyAs a UserI want ...Scenario 1Scenario 2

end user

developper

Biz Analyst

Rspec runs plain text Stories

end user

developper

Story: Logging in

As an anonymous user I want to login So that I can ...

Scenario: 1. When she goes to the page '/login' ...

same jargon!

Dan North Story format

Login feature

As an anonymous user with an account

I want to login to the application

So that I can access my personal data

Scenarios: Acceptance Criteria

Scenario 1: User inputs an invalid password

Given she goes to the page '/login'

When she fills in 'login' with '[email protected]'

When she fills in 'password' with 'testtest'

When she clicks the 'Log in' button

Then she should see the error message 'Couldn't log you'

Scenario 2: User inputs an invalid email

...

GIVEN: context, pre-conditions

Scenario 1: User inputs an invalid password

Given she goes to the page '/login'

When she fills in 'login' with '[email protected]'

When she fills in 'password' with 'testtest'

When she clicks the 'Log in' button

Then she should see the error message 'Couldn't log you'

WHEN: event, action

Scenario 1: User inputs an invalid password

Given she goes to the page '/login'

When she fills in 'login' with '[email protected]'

When she fills in 'password' with 'testtest'

When she clicks the 'Log in' button

Then she should see the error message 'Couldn't log you'

THEN: outcome, post conditions

Scenario 1: User inputs an invalid password

Given she goes to the page '/login'

When she fills in 'login' with '[email protected]'

When she fills in 'password' with 'testtest'

When she clicks the 'Log in' button

Then she should see the error message 'Couldn't log you'

RSpec

BDD Framework written in

also works on

Binding plain text / RSpec

Given she goes to the page '/login'

More binding

Write your own DSL

GIVEN ..

WHEN ..

THEN ..

Demo

Philippe Hanrigou reports

Cucumber by Aslak Hellesy

http://github.com/aslakhellesoy/cucumber/

Rewrite of story runner

more user friendly

inspired by FITNESS

Muokkaa otsikon tekstimuotoa napsauttamalla

Muokkaa jsennyksen tekstimuotoa napsauttamalla

Toinen jsennystaso

Kolmas jsennystaso

Neljs jsennystaso

Viides jsennystaso

Kuudes jsennystaso

Seitsems jsennystaso

Kahdeksas jsennystaso

Yhdekss jsennystaso

When "$actor fills in '$field' with '$value' " do|actor, field, value| $browser.type field, value end When "$actor clicks the '$button_link' button" do |actor, link| $browser.click_and_wait link end

Then "$actor should see the text '$text'" do |text| text.should be_present_in($browser) end

steps_for(:login) do

Given "$actor goes to the page '$path'" do |actor, path| $browser.open path end .......end