Tuesday, March 31, 2009

Grails code example: Integration testing quartz job

Here's a quick snippet to use to integration test a quartz job.
I couldn't find a clear example after a quick Google so hopefully this is useful.
There's a good chance that there's a better auto-magical way to get the job injected but I haven't poked through the testing code to work it out :)
package au.com.refactor

class TempCleanerJobTests extends GrailsUnitTestCase {

  def tempCleanerJob
  def grailsApplication

  protected void setUp() {
    super.setUp()
    tempCleanerJob = grailsApplication.mainContext.getBean(TempCleanerJob)
  }

  protected void tearDown() {
    super.tearDown()
  }

  void testCleanNothing() {
    tempCleanerJob.execute()
  }

}

Monday, March 30, 2009

Grails WebTest Plugin 1.1.2 Released

I've just released the latest version of the WebTest plugin for Grails. This was an update to fix a couple of issues with interactive mode use and parameter parsing and to de-couple the WebTest distribution zip. Highlights
  • run-webtest now supports -headless to stop the Swing progress gui being shown during test runs (this was previously possible via system properties, this is just a tidy up)
  • install-plugin webtest will now prompt you to download WebTest (currently version 3). It installs it into your .grails directory by default or you can answer 'n' and manually set the install location via webtest/conf/webtest.properties using wt.config.home