Some useful Geb / Grails / IntelliJ configuration parameters

Our team has been looking at making our functional tests better by improving the way in which we use Geb.

In this post, I want so summarize some useful configuration parameters for working with Grails, Geb and IntelliJ idea.

Specify a specific browser version.

To avoid having to rewrite all your tests whenever a new firefox version is released, you can specify a separate firefox bin file. We use 6.0.2 downloaded from

After unzipping this file in a location in your machine, you can then tell Geb to run tests using this file by pointing to the firefox bin file.


Chrome driver has a similar mechanism.

Specify a profile in your testing

If you want to use a firefox profile ( that included Firebug, for example ), you can set this by first calling

 firefox -ProfileManager 

Then, you can specify the profile being used via


Specify a baseUrl for JUnit tests

When running Geb tests as unit tests via IntelliJ idea, you can tell Geb the base url by setting the following environment variable:

To use this, just run your grails app with grails test run-app

Make IntelliJ read your geb configuration file

In order for IntelliJ to load your configuration files, you need to add it as a single module entry library.

  1. Add your Geb configuration file to your project. We put ours in the /test/functional directory.
  2. Add this file to your IntelliJ project dependencies via Project Structure -> Modules -> Dependencies
  3. Add a new ‘Single Module Entry Library’
  4. Select your functional directory. Save.

Now all your tests will be able to use the configuration file you have specified.

Alternatively, you can manually edit your project’s .iml file and add the following to the <component> element:

    <orderEntry type="module-library" scope="TEST">
          <root url="file://$MODULE_DIR$/test/functional" />
        <JAVADOC />
        <SOURCES />

( Based on a mailing list posting by Antony Jones / @antony. Credit to most of this is to Donovan Frew and Michael Stogowski ).


5 thoughts on “Some useful Geb / Grails / IntelliJ configuration parameters

  1. jneira

    Hi! thanks for your post(s), useful as always. I dont like to have the system properties in calls so i have added lines like:
    /* Configuracion de geb:
    Si no se pone nada usa el primero que encuentre segun el orden de la siguiente lista
    valores: htmlunit,firefox,ie,chrome

    in my Config.groovy

  2. Marcin Erdmann

    There is also another way of getting IntelliJ to read your GebConfig. If you put it in a root of any source directory (so /test/functional will do) then you can add “;GebConfig.groovy” at the end of Settings->Compiler->Resource patterns. This way you don’t have to create a Single Module Entry Library for every new geb tested grails project.

  3. chris anatalio

    When running your app as test-app, the VM parameter is not read into the application. It will only read the baseUrl from gebConfig.groovy. But the baseUrl from gebConfig.groovy will not read in any context beyond the base domain:

    How do you set the baseUrl when using test-app to run your application?


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s