Transcript
Page 1: [RuPy 2011] Automatic Acceptance Tests in Ruby

automatic

ACCEPTANCE TESTS

by @CS3B from @SELLEO

Page 2: [RuPy 2011] Automatic Acceptance Tests in Ruby
Page 3: [RuPy 2011] Automatic Acceptance Tests in Ruby

●acceptance tests vs integration tests

●view few examples●write example tests● look at cucumber●review some tools● look capybara api●documentations and write better api●some random tips about testing

Page 4: [RuPy 2011] Automatic Acceptance Tests in Ruby

http://toolmonger.com/2008/04/30/its-just-cool-87-tool-swiss-army-knife/

Page 5: [RuPy 2011] Automatic Acceptance Tests in Ruby

@ Alan Signer

Page 6: [RuPy 2011] Automatic Acceptance Tests in Ruby
Page 7: [RuPy 2011] Automatic Acceptance Tests in Ruby

http://blog.jonasbandi.net/2010/09/acceptance-vs-integration-tests.html

Page 8: [RuPy 2011] Automatic Acceptance Tests in Ruby

http://thecriticalpath.info/wp-content/uploads/2009/11/checklist.jpg http://www.shopperculture.com/photos/uncategorized/2009/01/11/value.gif http://www.ruthmalan.com/Journal/Images/ArchitectureDocumentS.jpg http://www.codework-systems.com/images/icons/netop/teacher.png

Page 9: [RuPy 2011] Automatic Acceptance Tests in Ruby

ACCEPTANCE !=

INTEGRATION

Page 10: [RuPy 2011] Automatic Acceptance Tests in Ruby

after new user register, it should be possible to spread word about our

product through her social channels to get more

customers

Page 11: [RuPy 2011] Automatic Acceptance Tests in Ruby

after new user register, it should be possible to spread word about our

product through her social channels to get more

customers

Page 12: [RuPy 2011] Automatic Acceptance Tests in Ruby

after new user register, it should be possible to

spread word about our product through her social

channels to get more customers

Page 13: [RuPy 2011] Automatic Acceptance Tests in Ruby

after new user register, it should be possible to spread word about our

product through her social channels to get more

customers

Page 14: [RuPy 2011] Automatic Acceptance Tests in Ruby

Examples:●post on twitter●post on

facebook●post on linkedin●post on ...

Page 15: [RuPy 2011] Automatic Acceptance Tests in Ruby

to attract people with hearing loss to site we should provide comprehensive article list that cover most important topics.

Important topic list: hearing loss , hearing aids, tinnitus, hearing rehabilitation

Page 16: [RuPy 2011] Automatic Acceptance Tests in Ruby

We should provide facilities to make easy for any

customers to contact with support team - also support

team should have easy reply channel. Feedback would

have impact on future development and

customer experience.

Page 18: [RuPy 2011] Automatic Acceptance Tests in Ruby

excercise #1

1.open web application that you have work in past / use

2. find and describe two acceptance criteria with all 3 elements so it could be used as initial specification (without implementation details)

Page 19: [RuPy 2011] Automatic Acceptance Tests in Ruby

http://archives.un.org/ARMS/sites/ARMS/uploads/images/1195421755148157000Andy_-_Tools_Hammer_Spanner_svg_hi.png

Page 20: [RuPy 2011] Automatic Acceptance Tests in Ruby

http://www.stat.uiowa.edu/~jcryer/22s008/righttool.htm

Page 21: [RuPy 2011] Automatic Acceptance Tests in Ruby

http://cukes.info/images/cuke_logo.png

Page 22: [RuPy 2011] Automatic Acceptance Tests in Ruby

Feature: Sharing info about site through social channels after new user register it should be possible to spread word about our product through her social networks to get more customers

# gain permission to post on wall automaticlyScenario: sign up through facebook

Scenario: ask user to post short message after registration

Page 23: [RuPy 2011] Automatic Acceptance Tests in Ruby

http://4.bp.blogspot.com/_1c6uKfrEfj0/S9ILYSIigII/AAAAAAAAFEU/hBcZO2mbD_I/s1600/mouse_robot.jpg

Page 24: [RuPy 2011] Automatic Acceptance Tests in Ruby

RSPEC

Page 25: [RuPy 2011] Automatic Acceptance Tests in Ruby

CAPYBARA

Page 26: [RuPy 2011] Automatic Acceptance Tests in Ruby
Page 27: [RuPy 2011] Automatic Acceptance Tests in Ruby
Page 28: [RuPy 2011] Automatic Acceptance Tests in Ruby

http://ui.thoughtbot.com/assets/capybara-driver.jpg

Page 29: [RuPy 2011] Automatic Acceptance Tests in Ruby

exercise #2

Bootstrap rspec and capybara in Ruby on Rails project

fetch project from:

http://bit.ly/workshop_app

Page 30: [RuPy 2011] Automatic Acceptance Tests in Ruby

exercise #3

Run simple test to

name of file:

spec/acceptance/home_page_spec.rb

Page 31: [RuPy 2011] Automatic Acceptance Tests in Ruby

exercise #4

Write essential acceptance test for e-commerce using

capybara api

name of file:

Page 32: [RuPy 2011] Automatic Acceptance Tests in Ruby

better api then capybara

●bbq●real production example

of similar idea

Page 33: [RuPy 2011] Automatic Acceptance Tests in Ruby

exercise #5

Write essential acceptance test for e-commerce using custom

api

name of file:

Page 34: [RuPy 2011] Automatic Acceptance Tests in Ruby

meta info

# We should provide facilities to make easy for any # customers to contact with support team - also support # team should have easy reply channel. Feedback # would have impact on future development and # customer experience.## milestone: one## value: essential## estimation: 21## scope: added## type: acceptance

Page 35: [RuPy 2011] Automatic Acceptance Tests in Ruby
Page 36: [RuPy 2011] Automatic Acceptance Tests in Ruby

scenario "contact with support", :status => 'done' do @customer.click "Contact Us", :within => "#sidebar"

---# ~/.spec--tag status:wip

---spork issue

Page 37: [RuPy 2011] Automatic Acceptance Tests in Ruby

http://i9.photobucket.com/albums/a65/Pasha_1950/Crash-1.jpg

Page 38: [RuPy 2011] Automatic Acceptance Tests in Ruby

huge initial data


Recommended