Cucumber seed for browser-based acceptance testing, with dockerized selenium for headless
- Get Docker for headless (boot2docker should also work out-of-the-box)
-
Write a feature file
google.feature
and save it in thefeatures
directoryFeature: Google In order to test google As a tester I need to visit google Scenario: Visit the site When I visit Google Then I should be on the Google site
-
Use the PageObject pattern, as implemented by the page-object gem. Create a GooglePage that inherits from BasePage (both of these files created in the
lib/pages
directory)base_page.rb:
class BasePage include PageObject end
google_page.rb:
class GooglePage < BasePage page_url 'google.com' end
-
Create step definitions (if you run
cucumber
it will generate some that you can copy & paste) in a filegoogle_steps.rb
in thefeatures/step_definitions
directoryWhen(/^I visit Google$/) do visit GooglePage end Then(/^I should be on the Google site$/) do on(GooglePage) do |page| expect(page.current_url).to include 'google.com' end end
-
Run the entire suite headlessly (will spawn and kill docker containers on the fly) by doing
$ cucumber HEADLESS=t
-
Generate the "sample feature" and step definitions in an Aruba test, instead of committing them directly
-
Parallelize this (using GNU parallel or the parallel_tests gem)
-
Convert this project from a "seed" to a generator similar to testgen