Rails test runner example app

Rails test runner

Summary

This is a simple rails application that allows remote execution of Ruby/Watir scripts. The scripts are expected to use test/unit (or otherwise provide meaningful console output).

The rails app runs on the client that will actually execute the tests; when a user accesses the application URL remotely, they should see a page containing the list of scripts available to run.

Clicking on a script's name will start execution, and the console output of the test script is displayed in the browser.

Installation and usage

Note that this app does not use or expect a database, so there's no need to set one up during install.

Install steps:

  1. On the client that will run the tests, install rails with 'gem install rails'
  2. Download runner.zip from the link below, and extract it in any dir on the client.
  3. Go into the extracted 'runner' dir and execute 'runner_start.bat'
  4. From either the local or a remote machine, open a browser and access http://HOST:3000
    (where HOST is your machine's address)
  5. Attempt to run the google test suite.
  6. If that works, place your own scripts into runner/data/suites/ and try to run them using the application.

A special note on running more than one test concurrently:

It is possible to execute more than one test script at the same time using this runner. However, this can result in problems when running Watir scripts against a target site that uses authentication, especially cookie-based authentication.

The most common problem appears when a Watir-driven browser accesses a site, and expects an authentication prompt - but if another browser is already open and authenticated with the target site, the second browser may reuse the credentials of the first browser. This might be because IE instances invoked using OLE automation (which Watir makes use of) appear to share the cookie state of any other IE instances open at the same time. This type of behavior is usually not seen in IE instances started manually.

Download

Name Size Creator Creation Date Comment  
ZIP Archive runner.zip 46 kB Bill Agee Mar 27, 2007 20:16    
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Mar 28, 2007

    David Brown says:

    Bill, Thank you very much for posting this test runner. It is great to finally ...

    Bill, Thank you very much for posting this test runner. It is great to finally have a way for developers who don't have Watir & Ruby installed on their machines to be able to run test and view the results remotely!

  2. May 18, 2007

    Robert Shaw says:

    Bill, This is awsome.. I have been looking for something like this. We use WAT...

    Bill,
    This is awsome.. I have been looking for something like this.
    We use WATIR to run compatability tests against vaious ie/os versions..
    Being able to run from one common lib.. Priceless..

    I am having an issue with some of our suite..

    Tests are not running and getting... with NO console output.
    ApplicationController: missing default helper path application_helper
    RunnerController: missing default helper path runner_helper

    Any Ideas..?

    => Booting Mongrel (use 'script/server webrick' to force WEBrick)
    => Rails application starting on http://0.0.0.0:3000
    => Call with -d to detach
    => Ctrl-C to shutdown server

      • Starting Mongrel listening at 0.0.0.0:3000
      • Starting Rails with development environment...
        C:/runner/config/environment.rb:4: warning: already initialized constant RAILS_R
        OOT
      • Rails loaded.
      • Loading any Rails specific GemPlugins
      • Signals ready. INT => stop (no restart).
      • Mongrel available at 0.0.0.0:3000
      • Use CTRL-C to stop.
        ApplicationController: missing default helper path application_helper
        RunnerController: missing default helper path runner_helper
  3. May 24, 2007

    Bill Agee says:

    Robert - I sent a PM to your forum username with some suggestions. And there's ...

    Robert - I sent a PM to your forum username with some suggestions.

    And there's another thing I just remembered to suggest: You might check to see if the problem scripts work when you manually execute them from a different directory. For example, cd to the root of your drive and run "ruby \path\to\script\foo.rb", and see if it works.

    If it complains about not finding a required file then it is probably why the script isn't working in the runner. The runner's working dir is the runner\ directory, and not the runner\suites\ dir, where the test scripts live. I should probably change that and post a new version of the app.

    There are a couple of ways to fix this on your end:

    • David Brown sent a small change to the Wtr-general list showing how to make Ruby cd into the suite dir before running a test. Here's the post:

    http://www.mail-archive.com/wtr-general@rubyforge.org/msg07822.html

    • Here's another way to fix it, inside the test script instead of the runner app:

    http://www.mail-archive.com/wtr-general@rubyforge.org/msg07895.html