Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Headless integration testing w/ HtmlUnit: enables testing JavaScript-driven web sites
JavaScript Ruby
tree: 99afef1bb8

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
doc
example/cucumber
lib
test
.gitignore
MIT-LICENSE
README.textile
Rakefile
TODO
init.rb

README.textile

Steam

Steam is a headless integration testing tool driving HtmlUnit to enable testing JavaScript-driven web sites. In that it is similar to Culerity which drives Celerity (which also drives HtmlUnit). See below for a comparsion.

Installation

Steam currently has the following dependencies:

  • Working Java Runtime
  • HtmlUnit (jar files)
  • RJB and Locator gems

Installing Steam as as a gem will automatically install the required RJB and Locator gems:

$ gem install steam

To install HtmlUnit you can download it from Sourceforge.

You then need to add HtmlUnit to your Java classpath. The following ways should both work:

# anywhere during startup, e.g. in features/support/env.rb
ENV['CLASSPATH'] = Dir["path/to/your/htmlunit/*.jar"].join(':')

# after steam has been added to the load path, e.g. in features/support/env.rb
Steam.config[:html_unit][:java_path] = 'path/to/your/htmlunit'

If you’re on Mac OS X then you also need to export the JAVA_HOME variable for RJB. See here for two solutions: Installing RJB on Mac OS X. The visudo way worked for us. Don’t forget to add yourself to the sudoers file, though.

Configuration

You should not need to configure anything. If you do need though have a look at Steam.config

E.g. in order to tweak the Java load params you can

Steam.config[:java_load_params] = "-Xmx2048M"

Usage

You can use Steam by itself as well as with Cucumber. You can find an example for a Cucumber setup in examples/cucumber/env.rb.

Steam is widely compatible with Webrat – many actions are implemented and take the same or very similar parameters as their Webrat equivalent. You even might be able to use the default webrat_steps.rb that ships with Cucumber, but his file is meant as an example and might be out of date.

Demo

You can find a demo application here: http://github.com/clemens/steam-demo

Comparsion to others

Steam’s advantages over Culerity/Celerity:

  • runs in Ruby MRI and does not require an entire JRuby environment.
  • Steam can have the HtmlUnit browser running in the same stack as your tests, thus making the whole thing less complex and hard to debug
  • Steam does not build on Celerity which is a quite heavy-weight Ruby wrapper around HtmlUnit adding a lot of unnecessary code
  • Steam uses Locator

Culerity/Celerity’s advantages over Steam:

  • RJB can’t resolve the mismatch of Ruby vs Java threads which makes fancy setups impossible to solve
  • Celerity implements a lot of stuff, maybe it contains something you need (e.g. maybe you want to test pop-down windows opening in the background?)
  • Steam still is in its infancy

Acknowledgements

Kudos to Alexander Lang for writing Culerity which pioneered full-stack AJAX-enabled integration testing in Rails.

Developers

TODO

  • explain requirement to start/restart a test server
  • explain log levels
Something went wrong with that request. Please try again.