This framework is a barebones quickstarter for any ruby automation projects you need. it comes out of the box and ready to go with some powerful features. Note: As you are probably already aware, ruby gems/dependencies can be quite annoying in terms of versions so if you end up running into issues you may need to use particular versions of some gems, at the moment however (14/12/2017) everything here works as expected. I've noticed Ruby-cucumber reporting is really poor visually, allure-Rspec is maybe ok but the plugins don't function on cucumber > 2.0.0 so I plan to build a nice looking html report in 2018.
Attributions: BuryTheHammer => Used his capybara quickstarter framework as a base for this and in general a very helpful guy
- Sequential and Parallel execution using rake tasks
- Browserstack integration for all your cloud/config needs
- Data aliasation with persistence across the steps
- Page object design pattern, coupled with PageFactory to load all pages into the (World)
- Cucumber Gherkin syntax for english readable feature files
- It's ruby so.. an abundance of effecient DSLs (e.g Watir)
- Driver and environment configuration
- Selenium grid support for local distribution across nodes (e.g docker-selenium / docker-zalenium)
- Json to HTML reporting, personally it's pretty ugly but its the best available at this moment
- Ruby (preferably with RVM)
- Ruby bundler gem ||
gem install bundle
- Firefox (optional)
- Chromedriver (optional)
- SeleniumGrid (again optional, useful to distribute tests to the hub for node selection)
- Zalenium-docker (optional - a cool scalable solution to a grid setup with VNC viewer, browser control panel etc)
- Ruby - Simple programming language => Rubymonk is great for cross training
- Rake - Ruby build utility
- Cucumber - English written tests in a BDD fashion
- Watir - Selenium webdriver wrapper with simple DSL
- BrowserStack - Platform as a service based cross browser/OS test execution.
- RSpec Expectations - Assert the expected results with a powerful 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.
- Slack-Results- A small gem I wrote to send automation results into a slack group, read the instructions there
- I18n-Localisation - Set expectations based on YAML files to account for testing of multilingual applications
- Logger - Basic logging of scenarios, each in their own json file when executing in parallel
- Report-builder - Automatically combining json results and dumping a html report in your directory
From the command line:
- Clone the project:
git clone https://github.com/symonk/Ruby-gui-framework-by-simonkay
- Add chromedriver/geckodriver executables to PATH environment variables.
- Navigate to the folder and
bundle install
to install all necessary gems. - Execute testing using rake tasks
- If you want to execute on selenium grid, use the rake task(s) and make sure the GRID hub + nodes are accessible
- Various other rake tasks exist that you could put in a jenkins pipeline to generate json results, convert them into a html frontend and then attach it to jenkins as artifacts
rake
default => runs a cucumber sequential session of @regression tests
rake parallel
runs a cucumber parallel session of @regression tests
To specify your browser, use the following (hopefully self-explanatory) tasks:
rake smoke
=> runs a sequential session of smoke testsrake smoke-p
=> runs a parallel session of smoke testsrake-browserstack
=> runs tests on browserstack (requires some configuration of env vars)
The environment and driver functionality can be customised via the environment variables, you can manually set these in the project base directory ./.env
- RUN_ON_LOCAL => if true => run tests on the local machine else => look for grid to distribute too
- SELENIUM_BROWSER => Browser to run tests on, chrome/firefox etc (this is used in both local and grid setup)
- SELENIUM_GRID_URL => Grid url to use when RUN_ON_LOCAL != true
- APPLICATION_NAME => Used to input into logging / sysout(puts) and reporting
- APPLICATION_BASEURL => Base url used for the application, still to build this into page objects page_urls
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.