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.

Leave end-to-end testing to Capybara

4,729 views

Published on

大江戸Ruby会議01

Published in: Technology
  • My thoughts about Cucumber and new Capybara DSL, checkout at http://inancgumus.com/66712574
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • high quality☆ reasonable price☆
    free shi pping accept pay pal,
    you can order all kind of things you want,
    believe me , trust me .
    ☆☆☆ www.happyshopping100.com -=★
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Leave end-to-end testing to Capybara

  1. 1. Leave end-to-end testing toCapybara SHIBATA Hiroshi Eiwa System Management,Inc.
  2. 2. SHIBATA Hiroshi a.k.a hsbtshibata.hiroshi@gmail.com tDiary commiter
  3. 3. http://www.hsbt.org/http://github.com/hsbt/http://twitter.com/hsbt/
  4. 4. asakusa.rb
  5. 5. SapporoRubyKaigi
  6. 6. RubyKaigi 2010
  7. 7. Capybara
  8. 8. Capybara
  9. 9. RSpec runner cucumber runner cucumber DSL(ja) RSpec DSL cucumber DSL capybara
  10. 10. RSpecExample
  11. 11. DSLfeature do background do setup_tdiary end scenario do visit / within(title) do page.should have_content( ) } end within(h1) do page.should have_content( ) end page.should have_css(a[href="update.rb"]) endend
  12. 12. Cucumber Example
  13. 13. Driver
  14. 14. Driver
  15. 15. HtmlUnit
  16. 16. javascript engine
  17. 17. SeleniumWebdriver
  18. 18. require ‘capybara/dsl’RSpec.configure do |config| config.include Capybara config.before(:all, :selenium => true) do Capybara.current_driver = :selenium endend
  19. 19. http://www.ne.jp/asahi/t/wada/articles/Refactoring_and_Test.pdf
  20. 20. best mix
  21. 21. DSLconfig.before(:all, :selenium => true) do Capybara.current_driver = :seleniumendconfig.after(:all, :selenium => true) do Capybara.use_default_driverend
  22. 22. DSLfeature " ", :selenium => true do let!(:administrator) { User.make! } before do login_as administrator visit new_admin_user_path end scenario " " do ( ) endend
  23. 23. capybara/rspec
  24. 24. DSLfeature " ", :driver => :akephalos do scenario " " do ( ) endendfeature " ", :js => true do scenario " " do ( ) endend=> :driver = :selenium
  25. 25. !!!
  26. 26. RubyKaigi 2011

×