Plugins You can find out about all the publicly available Grails plugins.


  • Tags: /
  • Latest: 0.1
  • Last Updated: 15 February 2010
  • Grails version: 1.1.1 > *
  • Authors: null
0 vote
compile "org.grails.plugins:uiregression:0.1"




grails install-plugin uiregression


The UIRegression plugin extends the SeleniumRC plugin and adds a ui-regression test type to the functional test phase.

The plugin uses selenium to capture a screenshot of a page and compare it with reference image. Which makes refactoring CSS a lot safer!

Writing Tests

After installing the plugin, you can create "UIRegressionTestCase" classes in the ui-regression directory.

An example test:

package samples
import net.jozefdransfield.uiregression.UIRegressionTestCase
class SampleUIRegressionTests extends UIRegressionTestCase {
  public void testSample() throws Exception {
    navigateToAndAssertScreenShot("testSample") {"/")  

"UIRegressionTestCase" resembles a regular SeleniumUnitTestCase, but adds the method "navigateToAndAssertScreenShot". This method expects a string parameter which is used for naming of this particular comparison test. It can be any name you want as long as it is unique. Typically it can be the same as the method name, unless you want to assert more than one screenshot. The second parameter is a closure where you can specify selenium commands to navigate to the page where you want to assert a screenshot.


The first time you run "grails test-app", the ui regression test phase will fail, because you have not established a reference image.

When you are ready to create reference screen shots you need to run

grails -Duiregression.regenerate=true <regular test app>


grails -Duiregression.regenerate=true test-app -functional // pre Grails 1.2
grails -Duiregression.regenerate=true test-app functional:ui-regression // Grails 1.2 +

(This switch can also be used to replace reference images in the future.)

Once a reference image is generated you can run test-app as normal, and when the rendering changes, the test will fail.


The plugin has the following defaults:

config.uiregression.browserstring = '*firefox'
config.uiregression.reference.path = 'test/ui-regression/reference/'
config.uiregression.result.path = 'test/reports/ui-regression/'
To configure where reference and result images will be stored = 'localhost'
config.uiregression.selenium.port = 4444
To configure the connection to the selenium server
config.uiregression.protocol = 'http'
 config.uiregression.hostname = 'localhost'
config.uiregression.port = 8080
To configure where to connect to your application

You can override these in the Config.groovy file under /conf