Improved Standalone Cucumber Test Suite¶ ↑
Introduction¶ ↑
We here at Carney+Co have not discovered how to limit ourselves to Rails only projects yet so we have come up with a simple generator gem that will create a standalone cucumber test inviroment in a folder of our choice. This is a kind of one stop method with the exception of some depdendencies to have the best and easiest to maniupulate test evnironment possible.
I have expanded this work from the original Author Todd Huss from which this project is forked. I basically added in some extra smarts from the internets to integrate webkit and chromedriver to the installation.
Some enhancements over the parent are a nice growing list of generic web_steps and file handling capabilities for downloading and uploading files to your sites.
blogs.kent.ac.uk/webdev/2012/08/02/using-capybara-webkit-with-cucumber-without-rails-or-rack/
And
collectiveidea.com/blog/archives/2011/09/27/use-chrome-with-cucumber-capybara/
I have also upgraded all the associated gems from the parent project so this install is far easier to get running out of the box
Changelog¶ ↑
0.0.8 Added file features for static files not previously downloaded and a simple helper to path to those files. Also began CSS class matching of elements by id. Added web_steps for select option handling
0.0.7 File download handling through file_steps - This provides a waiting mechanism inspired by collectiveidea.com/blog/archives/2012/01/27/testing-file-downloads-with-capybara-and-chromedriver/
0.0.6 Configuration of Capybara.app_host from command line and existing deployed test instance upgrade strategy
0.0.5 Added more web_steps
0.0.4 First Version
From the original author¶ ↑
I’ve included a simple search.feature examples that uses Google. To switch to use your own development or staging server adjust the URL in features/support/env.rb. I have this example project setup to use Capybara with Webdriver (Selenium) but you can easily switch this to use Culerity or Webrat by editing features/support/env.rb.
Pull requests with updates/enhancements/bug fixes are always welcome!
Project Layout¶ ↑
-
features/*.feature : cucumber features
-
features/step_definitions/web_steps.rb : generic steps that apply to all features
-
features/step_definintions/_steps.rb : steps specific to an individual feature file
-
support/env.rb : configures the driver and the hostname to use
Prerequisites¶ ↑
-
Ruby Gems rubygems.org/
-
Bundler: sudo gem install bundler rake
-
qt - brew install qt
-
ffi - brew install libffi
-
chromedriver - brew install chromedriver
Configuration¶ ↑
-
Bundle Install runs automatically once the test environment is setup
Setting up a test enviornmnet¶ ↑
-
gem install cuke-island
-
cuke-island <Directory to house testing files> [<Domain Name (google.com)>]
-
-
This second option will replace the Capybara.app_host = ‘www.google.com’ with your value.
-
Running Features¶ ↑
-
To run all features: cucumber
-
Or to add some options: rake
-
To use bundled gems: bundle exec cucumber
-
To run a specific feature: cucumber features/search.feature
Debugging¶ ↑
-
To debug a specific step call save_and_open_page within the step
Additional Documentation¶ ↑
-
cukes.info (for general cucumber information)
-
github.com/jnicklas/capybara (for actions such as click_link, click_button, etc…)