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 :)
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()
}
}
Comments
I was exactly wondering how to test my quartz job.
Thanks for you post, testing works perfect
Thanks !!!
Arigato !!!