JavaScript testing plugin plugin

Plugin details

This plugin provides the script.aculo.us JavaScript unit testing framework in a way that integrates with Rails applications.

Repositoryhttp://dev.rubyonrails.org/svn/rails/plugins/javascript_test/ Author Thomas Fuchs Tags Javascript, Tests LicenseMIT

Documentation

Install the plugin:
ruby script/plugin install http://dev.rubyonrails.org/svn/rails/plugins/javascript_test/

Generate a JavaScript test skeleton for your public/javascripts/foo.js file:

script/generate javascript_test foo


Run the unit tests (an "assertTruth" dummy test is provided, so you should see "SUCCESS" messages), and see the automagically controlled browsers in action:

rake test:javascripts


You have to manually close the browser window(s) afterwards.

You can also run the test manually, by symlinking the assets directory. In your Rails application root, run:

ln -s ../../vendor/plugins/javascript_test/assets/ test/javascript/assets


You then can just open the individual .html test files in your browser.

All in all, unittest.js is closely modelled on Test::Unit and there's also experimental support for RSpec-style BDD testing. You can find lots of examples in both the Prototype and script.aculo.us SVN repositories.

You'll find more info on how to write tests on the script.aculo.us wiki:
http://wiki.script.aculo.us/scriptaculous/show/UnitTesting.

Further Documentation

There is currently no advanced documentation for this plugin.

New documentation

Edit plugin | Back in time (1 older version) | Last edited by: Guest, 8 months ago