Dev Dives: Streamline document processing with UiPath Studio Web
Quality web-acceptance
1. AMIR BARYLKO
QUALITY DRIVEN
WEB ACCEPTANCE
TESTING
MVC CONFERENCE
FEB 2011
Amir Barylko - MvcConf MavenThought Inc.
Tuesday, February 8, 2011
2. WHO AM I?
• Architect
• Developer
• Mentor
• Great cook
• The one who’s entertaining you for the next hour!
Amir Barylko - MvcConf MavenThought Inc.
Tuesday, February 8, 2011
4. WHY TRADITIONAL
PROJECTS FAIL?
• Delivering late or over budget
• Delivering the wrong thing
• Unstable in production
• Costly to maintain
Amir Barylko - MvcConf MavenThought Inc.
Tuesday, February 8, 2011
5. BDD PRINCIPLES
• Behaviour Driven development is about implementing an
application by describing its behaviour from the perspective of
the stakeholder
• Enough is Enough
• Deliver stakeholder value
• It’s all behaviour
Amir Barylko - MvcConf MavenThought Inc.
Tuesday, February 8, 2011
7. GHERKIN DSL
• Business readable DSL
• Flush out requirements
• Documentation
• Automated testing
• Used by Cucumber,
SpecFlow, jBehave
Amir Barylko - BDD MavenThought Inc.
Tuesday, February 8, 2011
9. WHAT DO I NEED?
• The following folder structure
features: Folder for all the .feature files
step_definitions: all your step implementations (.rb)
support: setup environment, capybara, etc (.rb)
Amir Barylko - MvcConf MavenThought Inc.
Tuesday, February 8, 2011
10. SETUP
features/support/paths.rb
module NavigationHelpers
# Maps a name to a path. Used by the
#
# When /^I go to (.+)$/ do |page_name|
#
# step definition in web_steps.rb
#
def path_to(page_name)
case page_name
when /home/
'/'
when /Movies/
'/Movies'
...
Amir Barylko - MvcConf MavenThought Inc.
Tuesday, February 8, 2011
11. FEATURES
Feature: Addition
In order to make my library grow
As a registered user
I want to add movies to the library
Scenario: Add a movie
Given I have no movies
And I am on "home"
When I follow "create"
And I fill in "movie_title" with "Young Frankenstein"
And I press "Submit"
Then I should see "Young Frankenstein"
Amir Barylko - MvcConf MavenThought Inc.
Tuesday, February 8, 2011
12. STEPS
Given /^I have the following movies:$/ do |table|
db = SQLite3::Database.new( "C:/temp/movielib.db" )
db.execute( "delete from Movie" )
...
end
Given /^I have no movies$/ do
clear_database
end
Amir Barylko - MvcConf MavenThought Inc.
Tuesday, February 8, 2011
13. HOW DOES IT WORK?
• Read scenario step
Given I have no movies
• Match regular expression
Given /^I have no movies$/
• Run the code associated to the regular expression
clear_database
Amir Barylko - MvcConf MavenThought Inc.
Tuesday, February 8, 2011
15. WHAT
• Gem to simplify integration tests
• Inspired by Webrat
• Can be used with Cucumber steps or in any other test
• Easy to install: gem install capybara
Amir Barylko - MvcConf MavenThought Inc.
Tuesday, February 8, 2011
16. WHY
• Support for different web browsers (ie, firefox, chrome)
• Provides driver to run headless (virtual browser)
• Can tag scenarios to be run with a browser
• Supports remote web application (not rack)
• Supports asynchronous calls (AJAX)
Amir Barylko - MvcConf MavenThought Inc.
Tuesday, February 8, 2011
17. SETUP
features/support/capybara.rb
require 'capybara/cucumber'
require 'selenium-webdriver'
#Capybara.default_driver = :culerity
Capybara.default_driver = :selenium
Capybara.app_host = "http://localhost:1591"
Capybara.run_server = false
Capybara.default_wait_time = 5
Capybara.default_selector = :css
Capybara.register_driver :selenium do |app|
#Capybara::Driver::Selenium.new(app, :browser => :ie)
Capybara::Driver::Selenium.new(app, :browser => :chrome)
end
Amir Barylko - MvcConf MavenThought Inc.
Tuesday, February 8, 2011
18. STEPS
• Given I am on the Home page
• When I go to the Projects page
• When I press “login”
• When I follow “help” within “support”
Amir Barylko - MvcConf MavenThought Inc.
Tuesday, February 8, 2011
19. STEPS II
• When I fill “username” with “mel”
• When I select “Winnipeg” from “cities”
• When I check “remember_me”
• When I uncheck “remember_me”
• When I choose “Option”
Amir Barylko - MvcConf MavenThought Inc.
Tuesday, February 8, 2011
20. STEPS III
• Then I should see “Welcome”
• Then I should not see “Welcome”
• Then the field “user” should contain “Mel”
• Then show me the page
Amir Barylko - MvcConf MavenThought Inc.
Tuesday, February 8, 2011