Skip to content
bsag edited this page Jul 16, 2011 · 4 revisions

Testing

Testing Tracks is fairly simple. All you need to do is install a couple of bundles and run the suite! All tests are stored in $RAILS_ROOT/test.

Setup

The tests make use of some gems which need to be installed first

Install required gems with


rake gems:install RAILS_ENV=test 

rake gems:install RAILS_ENV=selenium

Running the Rails test suite

Assuming you’ve already checked out the source code using git, change to the root directory of the project ($RAILS_ROOT) and run


rake test

If it completes successfully 0 failures, you’re good to go!

Running the RSpec test suite

To run the Rspec tests run


rake spec

Running the cucumber test suite

For integration testing Tracks uses cucumber. For those features that require javscript/ajax, Tracks uses Selenium on Webrat

To run the features excluding the selenium features and the work-in-progress (wip) features, run


rake cucumber

To run the features that make use of Selenium on Webrat, run


rake cucumber:selenium

To run the features that are work in progress run these:


rake cucumber:selenium_wip

rake cucumber:wip


To run a feature by hand run these. Please note the different RAILS_ENV value and the -p usage for selenium:


RAILS_ENV=cucumber cucumber features/my_feature.feature

RAILS_ENV=selenium cucumber -p selenium features/my_feature.feature


Running the tests headless

All tests will run on a headless setup except for the selenium tests. They will need a webbrowser which will need a running X-server.

You can solve this by running a virtual framebuffer X server. In Fedora, you need to install the packages xorg-x11-server-Xvfb and xorg-x11-apps


Xvfb :99 -ac -screen 0 1024x768x16 &

DISPLAY=:99.0 rake cucumber:selenium

killall Xvfb

Running the old browser-based Selenium test suite

We are migrating from the selenium test suite in the browser to cucumber and selenium on webrat. To run the selenium scripts that are not yet migrated, the following still applies:

To run the suite simply run Tracks in the test environment:


  script/server -e test

in a separate command window, then run


  rake test:acceptance

and Firefox will pop up and run the suite. If this does not work, you can run the suite manually by launching the server in test mode with the command above, and navigating to

http://localhost:3000/selenium/ in your browser of choice.

Clone this wiki locally