Web acceptance testing - where do you start? This is a quickstart project with good practice that you can clone and extend, rather than having to google constantly to find out the basics. There's some very powerful stuff included in this project which is ready to use out of the box, including parallel execution, browserstack integration, and aliased random data persistence.
- Acceptance tests written in plain English
- Page Object pattern
- Parallel test execution
- Test data persistence across cucumber step definitions
- Powerful DSLs to enforce good practice and terse code
- Switchable drivers / browsers
- BrowserStack support for remote execution
- Headless browser testing
- Aliased and randomised data generation to prevent data collisions
- Rake execution tasks
Make sure you have the following installed before starting:
- Ruby (preferably with RVM)
- Ruby bundler gem
- Phantom.js
- Firefox (optional)
- Chromedriver (optional)
If you're using OSX, Phantom.js and Chromedriver are available via Homebrew.
- Ruby - a dynamic, simple programming language.
- Rake - a build utility for Ruby.
- Cucumber - a BDD tool for writing acceptance tests in plain English.
- Capybara - a driver-agnostic web acceptance test framework and DSL.
- SitePrism - a page object DSL for Capybara.
- Poltergeist - a Capybara driver for the headless browser Phantom.js.
- Selenium WebDriver - Browser automation framework.
- BrowserStack - Platform as a service based cross browser/OS test execution.
- RSpec Expectations - a powerful assertions DSL.
- Parallel_Tests - A gem for parallel threading of cucumber tests.
- Factory Girl - A data template factory for producing test data.
- FFaker - A random data generation library.
- Relish - Automatic feature documention generation for Cucumber
From the command line:
- Clone the project:
git clone https://github.com/burythehammer/ruby-acceptance-testing-quickstart
- Navigate to the folder and
bundle install
to install all necessary gems. - Start running tests using the available rake tasks.
rake demo
will run a headless browser test.
rake parallel_demo
will execute a demo parallel test.
To specify your browser, use the following (hopefully self-explanatory) tasks:
rake firefox
rake chrome
rake phantomjs
rake parallel_firefox
rake parallel_chrome
rake parallel_phantomjs
Or if you wish to run every browser, you can run rake crossbrowser
.
Browserstack is available via rake browserstack
. You will need to set up your environment variables via the .env file first, to specify your login credentials and required browser/OS. To use this as part of a secure CI environment, Browserstack have an excellent guide on their website to keep your credentials secure.