Problem with testing .. JetGroovy 1.5/Grails1.0.2/Groovy 1.5.6 ..

Sorry if this is off topic but hope someone can help ... Using Groovy 1.5.6 / Grails 1.0.2 . JetGroovy plugin 1.5 .. New(ish) to Groovy / Grails and working thru 'Getting Started With Grails'

.. Having problems with testing .. Using following for testing, lifted straight from book

private Race getValidRace() {
def race = new Race() = 'Fast 5K'
race.startDateTime = new Date().plus(1) // 1 day in the future = 'Somewhere'
race.state = 'NC'
race.distance = 3.1
race.cost = 20.00
race.maxRunners = 1000

// Make sure that we have indeed constructed a valid Race object
assertTrue race.validate()

return race

When i run all tests via GUI I get .. groovy.lang.MissingMethodException: No signature of method: Race.validate() is applicable for argument types: () values: {} ..

If I run the same tests via grails using ' test-app' directly everything works as expected and all tests pass .. The actual application runs fine , just the testing I have problems with ...

Anyone have any idea ?

Thanks ..

Comment actions Permalink

Sorry , configuration error .. Corrected ..and works ..

Comment actions Permalink


Glad you found the configuration issue. Now, would you tell me what it was since I'm having the same problem? :) (I should never code at 2:30am anyway!)

Edited by: jj_jackson on Jul 26, 2008 3:00 AM

Comment actions Permalink

You cannot test Grails classes from within IntelliJ, since they need to be injected by Grails (eg the Dynamic GORM methods/validae). When you want to do a normal unit test without any Grails specific features, it shouldn't be a problem, but when you start using Grails features like constraints, manyToMany attrbitutes, etc, you're out of luck and you'll have to use the Grails test-app target.


Please sign in to leave a comment.