This information is out of date – please see http://www.grails.org/jsUnit+plugin
grails-jsunit provides an easy and convenient way to utilize the JsUnit framework to your grails application. JsUnit allows you to unit test JavaScript functions in a similar way to using JUnit for Java.
To install the plugin, use:
grails install-plugin http://www.javathinking.com/grails/grails-jsunit-plugin/0.1/grails-jsunit-0.1.zip
This plugin adds the following new scripts:
create-jsunit-test
Generates a new empty jsunit test. Supply the path of the test you want to create, relative to ‘test/jsunit/tests’.
Example use:
grails create-jsunit-test registration/mytest
creates
${basedir}/test/jsunit/tests/registration/mytest.html
run-jsunit
Runs JsUnit in the specified browser. Specify the path to your browser as a command line parameter i.e.
grails run-jsunit /usr/bin/firefox
or, if the executable is on the path you would just need
grails run-jsunit firefox
In your application.properties, you can specify:
jsunit.autoRun=true
When executing this script, it overwrites ${basedir}/test/jsunit/suiteAll.html to build a suite that references all tests in ${basedir}/test/jsunit/test.






{ 1 comment… read it below or add one }
Hi Paul,
thank you for the plugin, it really rocks.
It worked out of the box for Ubuntu.
We had to apply a small change to get the RunJsunit.groovy script working on Windows. (We support both operating systems for the development environments.)
We changed the generation of the suiteAll.html slightly – as the script originally generated backslashes within the test file paths on windows – which jsunit could not handle.
tests.each() { test ->
testsString << “”" newsuite.addTestPage(“../${test.replace(‘\\’, ‘/’)}”);\n”"”
}
Do you think it was worth considering including a fixture for this file path issue within the next release of the plugin?
Cheers, Dora