Home > Java, Web > grails-selenium-0.3

grails-selenium-0.3

by paul on March 13, 2008

Version 0.3 of the grails selenium plugin is now available.

This version:

  • Adds GSP support for writing tests
  • Fixes bug where hidden directories were shown as suites
  • Fixes bug on windows with invalid URIs to html tests

To use GSP to generate the tests, use the <sel:test> tag, followed by nested <sel:row> tags.

<sel:row> can take either:

  • one ‘line’ attribute where the command, target and value are pipe separated as per the pipe separated value files
  • or separate ‘command’, ‘target’, and ‘value’ attributes.

Because this is a normal GSP file, you have full access to the normal variables and you could call other classes for utility methods.

An example GSP test:

<g:set var="bookTitle" value="book0d"/>
<sel:test name="MyTest">
<sel:row command="open" target="${request.contextPath}"/>
<sel:row line="clickAndWait|link=BookController"/>
<sel:row line="clickAndWait|link=New Book"/>
<sel:row command="type" target="title" value="${bookTitle}"/>
<sel:row line="clickAndWait|//input[@value='Create']"/>
<sel:row line="clickAndWait|link=Book List"/>
<sel:row line="verifyTextPresent|${bookTitle}"/>
</sel:test>

Download grails-selenium-0.3.zip

Also see:

{ 6 comments… read them below or add one }

Graeme Rocher March 14, 2008 at 3:12 am

Looks neat, you should make it available in the Grails central repo at plugins.grails.org

Matt Raible March 14, 2008 at 7:39 am

It’d be pretty cool to add “grails create-selenium” like the Canoo WebTest plugin has.

paul March 14, 2008 at 10:33 am

Graeme – I plan to, I assume I need to create a login for subversion separate from my JIRA login? (already have a JIRA one but that doesn’t seem provide access to everything)

Matt – good idea, I’ll get on it.

Rob James March 14, 2008 at 6:12 pm

Great work Paul.

I have been playing with version 0.2 in one of my projects and it works seamlessly. Actually great timing, as I was having issues with getting the Canoo tests to work, issue with some of the Ajax javascript libraries, which of course Selenium doesn’t care about.

+1 on the “grails create-selenium” script

paul March 15, 2008 at 12:36 am

Rob, thanks for the feedback.

I’m working on:
1. create-selenium-test which takes a path to a file relative to the selenium/tests directory and creates an empty test file.
So, grails create-selenium-test register/invalidlogin.gsp would create web-app/selenium/tests/register/invalidlogin.gsp and like wise if you specify a file ending with .html or .psv

2. create-selenium-domain-test which creates the same tests as the webtest plugin. This may turn out useful for showing the advantages between the different types (gsp, html, psv)

3. run-selenium which fires up the browser pointing at the tests. This was suggested by another user, who pointed out this would help with continuous integration.

Graeme Rocher March 21, 2008 at 5:36 am

Hi Paul,

basically you need to signup for a codehaus account at

http://xircles.codehaus.org/signup

Then apply to be a developer at

http://xircles.codehaus.org/projects/grails-plugins/members

Once that is done email me and I’ll approve and let you know next steps

Cheers
Graeme

Leave a Comment

Previous post:

Next post: