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 Ruby's Test::Unit module, although modifying the app to properly handle other types of console output would be trivial.

The Rails app runs on the client intended to 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 a database, so there's no need to configure one during installation.

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. Start a cmd.exe shell and cd into the extracted 'runner' dir.
  4. Launch the app with the command "ruby script/server"
  5. From either the local or a remote machine, open a browser and access http://HOST:3000
    (where HOST is your machine's address)
  6. Attempt to run the google test suite. (Note: Watir must be installed for the google suite to work.)
  7. If that works, place your own scripts into runner/db/test_files/suites/ and try to run them using the application.

Download

Name Size Creator Creation Date Comment  
ZIP Archive runner.zip 290 kB Bill Agee Apr 03, 2010 16:18 Updated for Rails 2.3.5, and added path resolution fix provided by David Brown  
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

  4. Apr 19, 2010

    Lokesh says:

    Thanks Bill. Nice to see updated version. Its working perfectly fine. :) Cheer...

    Thanks Bill.

    Nice to see updated version. Its working perfectly fine. :)

    Cheers,

    Lokesh Agrawal

  5. Oct 14, 2010

    Felipe Vega says:

    Hi, I've got the following error after clicking on the unique link at home page...

    Hi,

    I've got the following error after clicking on the unique link at home page:

    C:\Runner>ruby -CC:/Runner/script/../db/test_files/suites C:/Runner/script/../db/test_files/suites/google_suite.rb -- -v verbose  1>log/runner/console-2010-10-14_-_10-03-37.log
    The system cannot find the path specified.

    Any suggestion?

    Thanks,

    Felipe

  6. Oct 18, 2010

    Zeljko says:

    We do not provide support via comments. For support please see http://watir.com/...

    We do not provide support via comments. For support please see http://watir.com/support