Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Quality web-acceptance

920 views

Published on

Published in: Technology
  • Hello there! Get Your Professional Job-Winning Resume Here! http://bit.ly/topresum
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Be the first to like this

Quality web-acceptance

  1. 1. AMIR BARYLKO QUALITY DRIVEN WEB ACCEPTANCE TESTING MVC CONFERENCE FEB 2011Amir Barylko - MvcConf MavenThought Inc.Tuesday, February 8, 2011
  2. 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
  3. 3. BDDAmir Barylko - MvcConf MavenThought Inc.Tuesday, February 8, 2011
  4. 4. WHY TRADITIONAL PROJECTS FAIL? • Delivering late or over budget • Delivering the wrong thing • Unstable in production • Costly to maintainAmir Barylko - MvcConf MavenThought Inc.Tuesday, February 8, 2011
  5. 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 behaviourAmir Barylko - MvcConf MavenThought Inc.Tuesday, February 8, 2011
  6. 6. OUTSIDE IN APPROACHAmir Barylko - MvcConf MavenThought Inc.Tuesday, February 8, 2011
  7. 7. GHERKIN DSL • Business readable DSL • Flush out requirements • Documentation • Automated testing • Used by Cucumber, SpecFlow, jBehaveAmir Barylko - BDD MavenThought Inc.Tuesday, February 8, 2011
  8. 8. CUCUMBERAmir Barylko - MvcConf MavenThought Inc.Tuesday, February 8, 2011
  9. 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. 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. 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. 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 endAmir Barylko - MvcConf MavenThought Inc.Tuesday, February 8, 2011
  13. 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_databaseAmir Barylko - MvcConf MavenThought Inc.Tuesday, February 8, 2011
  14. 14. CAPYBARAAmir Barylko - MvcConf MavenThought Inc.Tuesday, February 8, 2011
  15. 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 capybaraAmir Barylko - MvcConf MavenThought Inc.Tuesday, February 8, 2011
  16. 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. 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) endAmir Barylko - MvcConf MavenThought Inc.Tuesday, February 8, 2011
  18. 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. 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. 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 pageAmir Barylko - MvcConf MavenThought Inc.Tuesday, February 8, 2011
  21. 21. DEMOAmir Barylko - MvcConf MavenThought Inc.Tuesday, February 8, 2011
  22. 22. QUESTIONS?Amir Barylko - MvcConf MavenThought Inc.Tuesday, February 8, 2011
  23. 23. RESOURCES • Email: amir@barylko.com • Twitter: @abarylko • Materials: http://www.orthocoders.com/presentationsAmir Barylko - MvcConf MavenThought Inc.Tuesday, February 8, 2011
  24. 24. RESOURCES II • Capybara: https://github.com/jnicklas/capybara • Cucumber: https://github.com/aslakhellesoy/cucumber/wiki • Culerity: https://github.com/langalex/culerity • Celerity: http://celerity.rubyforge.org • Selenium: http://seleniumhq.orgAmir Barylko - MvcConf MavenThought Inc.Tuesday, February 8, 2011

×