Your SlideShare is downloading. ×
0
Capybara
Capybara
Capybara
Capybara
Capybara
Capybara
Capybara
Capybara
Capybara
Capybara
Capybara
Capybara
Capybara
Capybara
Capybara
Capybara
Capybara
Capybara
Capybara
Capybara
Capybara
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Capybara

3,064

Published on

Presentation about Integration Tests using Capybara, Selenium and Rails.

Presentation about Integration Tests using Capybara, Selenium and Rails.

Published in: Technology
0 Comments
6 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
3,064
On Slideshare
0
From Embeds
0
Number of Embeds
9
Actions
Shares
0
Downloads
30
Comments
0
Likes
6
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. CapybaraAlmir M3nd3s Flávia Missi@m3nd3s @flaviamissialmirmendes.com flaviamissi.com.br
  • 2. Unit testsFunctional test
  • 3. User + Browser
  • 4. Integration tests
  • 5. http://www.flickr.com/photos/kalebdf/3172638676/ Ué... nãoaconteceu nada! Capybara simulates how a real user would interact with a web application
  • 6. Sinatra
  • 7. Selenium HQ
  • 8. gem install capybara
  • 9. spec_helper.rb require capybara/rails require capybara/rspec
  • 10. Capybara.default_driver = :seleniumCapybara.register_driver :selenium do |app| Capybara::Driver::Selenium.new( app, :browser => :chrome) end
  • 11. visit(/projects)visit(post_comments_path(post)) current_path
  • 12. Simulating click
  • 13. click_link(id-of-link) click_link(Link Text) click_button(Save) click_on(Link Text)click_on(Button Value)
  • 14. Filling html forms
  • 15. fill_in(First Name, :with => John) choose(A Radio Button) check(A Checkbox) uncheck(A Checkbox)attach_file(Image, /path/to/image.jpg) select(Option, :from => Select Box)
  • 16. within("li#employee") do fill_in Name, :with => Jimmyendwithin(:xpath, "//li[@id=employee]") do fill_in Name, :with => Jimmyend
  • 17. Queryingpage.has_selector?(table tr)page.has_selector?(:xpath, //table/tr)page.has_no_selector?(:content)page.has_xpath?(//table/tr)page.has_css?(table tr.foo)page.has_content?(foo)
  • 18. RSpec Queryingpage.should have_selector(table tr)page.should have_selector(:xpath, //table/tr)page.should have_no_selector(:content)page.should have_xpath(//table/tr)page.should have_css(table tr.foo)page.should have_content(foo)page.should have_no_content(foo)
  • 19. Valeu! É nozes!
  • 20. Linkshttp://rubydoc.info/github/jnicklas/capybara/master/file/README.rdochttps://github.com/jnicklas/capybara

×