Saturday, 22 March 2008

grails-selenium-0.4

This information is out of date - please see http://www.grails.org/Selenium+plugin



Version 0.4 of the grails selenium plugin is now available.

This version adds:

  • scripts to create and run tests

  • a postResults url for displaying the final test results


Details are as follows:

run-selenium
Runs Selenium in the specified browser.
Specify the path to your browser as a command line parameter i.e.
grails run-selenium /usr/bin/firefox

or, if the executable is on the path you would just need
grails run-selenium firefox

In your application.properties, you can specify:
selenium.auto=true
selenium.close=true
selenium.multiWindow=true
selenium.highlight=true
selenium.resultsUrl=/your/url/here (defaults to ${appContext}/selenium/postResults)
selenium.runInterval=1000
selenium.baseUrl=

See http://selenium.openqa.org/installing.html (section titled Continuous Integration) for more information on selenium and continuous integration.
create-selenium-test
Generates a new empty selenium test.

Supply the path of the test you want to create, relative to 'web-app/selenium/tests'. The extension of this must be one of html, psv, gsp. The test file will be created using the syntax based on the file extension.

Example use:
grails create-selenium-test registration/errors/InvalidUsername.gsp

creates
web-app/selenium/tests/registration/errors/InvalidUsername.gsp

create-selenium-domain-test
Generates a new selenium test for the given domain class.

Supply the name of the domain class you want to test, followed by and extension that identifies the sytax to use. The extension of this must be one of html, psv, gsp.

Example use:
grails create-selenium-domain-test book.gsp

creates
web-app/selenium/tests/book.gsp

The generated test exercises the default grails scaffolding for CRUD functionality.

postResults page
A basic postResults page is provided, and if required the results can be saved to xml.

When using grails run-selenium, you can add properties to application.properties:

  • selenium.auto=true

  • selenium.resultsUrl=/your/url/here (defaults to ${appContext}/selenium/postResults)

  • selenium.saveXmlTo=/tmp/selenium.xml


By default resultsUrl is set as  ${appContext}/selenium/postResults which is provided as a basic HTML implementation. Nothing fancy.

Download here or install with
grails install-plugin http://www.javathinking.com/grails/grails-selenium-plugin/0.4/grails-selenium-0.4.zip