Headless browser testing with ruby

  • View

  • Download

Embed Size (px)



Text of Headless browser testing with ruby

  • 1. Headless Browser Testingwith Rubyby Justin Halsall (@juice10)CTO of Betribes.com
  • 2. Our process
  • 3. Make user storieswrite out all the different actions users can andcant do
  • 4. Write out Acceptance testsUsing Rspec/Steak
  • 5. Run the tests!Doesnt do much but its working!
  • 6. Write out the rst scenarioDo this before you actually create the feature
  • 7. Run the tests!And it fails! But we where expecting that...
  • 8. Go ahead!Create thatfeature!Yeah boi, its hammertime!
  • 9. Run it again and... no failures!Yippy!
  • 10. That wasnttoo hardLets step it up
  • 11. Write out the second scenario
  • 12. Visit the page
  • 13. Specify area with CSS expression
  • 14. Click on the link
  • 15. Make sure you end up where you expect
  • 16. Run tests: Red, green, refactorhttp://www.ickr.com/photos/tasuki/3503304405
  • 17. Of course you can do moreeg. interacting with forms
  • 18. Of course you can do moreeg. interacting with forms
  • 19. Wow that was awesome!Yeah I know right!
  • 20. Whats the difference?
  • 21. Its way faster!http://www.ickr.com/photos/scallop_holden/2203771977
  • 22. Headless Browser vsSeleniumSpeed speed speeeed! (our test suitetakes 30 minutes to complete on a fastmachine using a headless web browser)Easier to set up the environment andtest edge cases.Abstracted so easy to change out fordifferent browser in the future.
  • 23. Tools Ruby http://ruby-lang.org Rspec http://rspec.info/ Capybara https://github.com/jnicklas/capybara HtmlUnit http://htmlunit.sourceforge.net/optio nal Akaphelos http://oinopa.com/akephalos/optio nal Steak https://github.com/cavalle/steakoptio nal Ruby on Rails http://rubyonrails.comoptio nal Machinist https://github.com/notahat/machinist
  • 24. Kthnx questions?Me: Justin HalsallTwitter: @juice10E-mail: justin@betribes.comGuess whos looking for colleagues?We are! .com