Headless browser testing with ruby
-
Upload
justin-halsall -
Category
Technology
-
view
4.178 -
download
0
description
Transcript of Headless browser testing with ruby
![Page 1: Headless browser testing with ruby](https://reader033.fdocuments.in/reader033/viewer/2022050801/545c9422af7959c3098b4801/html5/thumbnails/1.jpg)
Headless Browser Testing with Rubyby Justin Halsall (@juice10)
CTO of Betribes.com
![Page 2: Headless browser testing with ruby](https://reader033.fdocuments.in/reader033/viewer/2022050801/545c9422af7959c3098b4801/html5/thumbnails/2.jpg)
Our process
![Page 3: Headless browser testing with ruby](https://reader033.fdocuments.in/reader033/viewer/2022050801/545c9422af7959c3098b4801/html5/thumbnails/3.jpg)
Make user storieswrite out all the different actions users can and can’t do
![Page 4: Headless browser testing with ruby](https://reader033.fdocuments.in/reader033/viewer/2022050801/545c9422af7959c3098b4801/html5/thumbnails/4.jpg)
Write out Acceptance testsUsing Rspec/Steak
![Page 5: Headless browser testing with ruby](https://reader033.fdocuments.in/reader033/viewer/2022050801/545c9422af7959c3098b4801/html5/thumbnails/5.jpg)
Run the tests!Doesn’t do much but its working!
![Page 6: Headless browser testing with ruby](https://reader033.fdocuments.in/reader033/viewer/2022050801/545c9422af7959c3098b4801/html5/thumbnails/6.jpg)
Write out the first scenarioDo this before you actually create the feature
![Page 7: Headless browser testing with ruby](https://reader033.fdocuments.in/reader033/viewer/2022050801/545c9422af7959c3098b4801/html5/thumbnails/7.jpg)
Run the tests!And it fails! But we where expecting that...
![Page 8: Headless browser testing with ruby](https://reader033.fdocuments.in/reader033/viewer/2022050801/545c9422af7959c3098b4801/html5/thumbnails/8.jpg)
Go ahead! Create that feature!Yeah boi, its hammer time!
![Page 9: Headless browser testing with ruby](https://reader033.fdocuments.in/reader033/viewer/2022050801/545c9422af7959c3098b4801/html5/thumbnails/9.jpg)
Run it again and... no failures!Yippy!
![Page 10: Headless browser testing with ruby](https://reader033.fdocuments.in/reader033/viewer/2022050801/545c9422af7959c3098b4801/html5/thumbnails/10.jpg)
That wasn’t too hardLets step it up
![Page 11: Headless browser testing with ruby](https://reader033.fdocuments.in/reader033/viewer/2022050801/545c9422af7959c3098b4801/html5/thumbnails/11.jpg)
Write out the second scenario
![Page 12: Headless browser testing with ruby](https://reader033.fdocuments.in/reader033/viewer/2022050801/545c9422af7959c3098b4801/html5/thumbnails/12.jpg)
Visit the page
![Page 13: Headless browser testing with ruby](https://reader033.fdocuments.in/reader033/viewer/2022050801/545c9422af7959c3098b4801/html5/thumbnails/13.jpg)
Specify area with CSS expression
![Page 14: Headless browser testing with ruby](https://reader033.fdocuments.in/reader033/viewer/2022050801/545c9422af7959c3098b4801/html5/thumbnails/14.jpg)
Click on the link
![Page 15: Headless browser testing with ruby](https://reader033.fdocuments.in/reader033/viewer/2022050801/545c9422af7959c3098b4801/html5/thumbnails/15.jpg)
Make sure you end up where you expect
![Page 16: Headless browser testing with ruby](https://reader033.fdocuments.in/reader033/viewer/2022050801/545c9422af7959c3098b4801/html5/thumbnails/16.jpg)
Run tests: Red, green, refactorhttp://www.flickr.com/photos/tasuki/3503304405
![Page 17: Headless browser testing with ruby](https://reader033.fdocuments.in/reader033/viewer/2022050801/545c9422af7959c3098b4801/html5/thumbnails/17.jpg)
Of course you can do moreeg. interacting with forms
![Page 18: Headless browser testing with ruby](https://reader033.fdocuments.in/reader033/viewer/2022050801/545c9422af7959c3098b4801/html5/thumbnails/18.jpg)
Of course you can do moreeg. interacting with forms
![Page 19: Headless browser testing with ruby](https://reader033.fdocuments.in/reader033/viewer/2022050801/545c9422af7959c3098b4801/html5/thumbnails/19.jpg)
Wow that was awesome!Yeah I know right!
![Page 20: Headless browser testing with ruby](https://reader033.fdocuments.in/reader033/viewer/2022050801/545c9422af7959c3098b4801/html5/thumbnails/20.jpg)
Whats the difference?
![Page 21: Headless browser testing with ruby](https://reader033.fdocuments.in/reader033/viewer/2022050801/545c9422af7959c3098b4801/html5/thumbnails/21.jpg)
Its way faster!http://www.flickr.com/photos/scallop_holden/2203771977
![Page 22: Headless browser testing with ruby](https://reader033.fdocuments.in/reader033/viewer/2022050801/545c9422af7959c3098b4801/html5/thumbnails/22.jpg)
Speed speed speeeed! (our test suite takes 30 minutes to complete on a fast machine using a headless web browser)
Easier to set up the environment and test edge cases.
Abstracted so easy to change out for different browser in the future.
Headless Browser vs Selenium
![Page 23: Headless browser testing with ruby](https://reader033.fdocuments.in/reader033/viewer/2022050801/545c9422af7959c3098b4801/html5/thumbnails/23.jpg)
ToolsRuby http://ruby-lang.org
Rspec http://rspec.info/
Capybara https://github.com/jnicklas/capybara
HtmlUnit http://htmlunit.sourceforge.net/
Akaphelos http://oinopa.com/akephalos/
Steak https://github.com/cavalle/steak
Ruby on Rails http://rubyonrails.com
Machinist https://github.com/notahat/machinist
optional
optional
optional
optional
![Page 24: Headless browser testing with ruby](https://reader033.fdocuments.in/reader033/viewer/2022050801/545c9422af7959c3098b4801/html5/thumbnails/24.jpg)
Kthnx questions?
Me: Justin Halsall
Twitter: @juice10
E-mail: [email protected]
Guess who’s looking for colleagues?
We are! .com