groovy - Grails - save() failing with MissingMethodExcepition in integration test -
i'm learning groovy / grails, , writing first integration test.
it's failing with:
groovy.lang.missingmethodexception: no signature of method: com.mangofactory.scurry.user.save() applicable argument types: () values: []
my test isn't doing fancy:
class usereventcontrollertests extends controllerunittestcase { protected void setup() { super.setup() } protected void teardown() { super.teardown() } void testaddingauser() { def user = new user(emailaddress: "martypitt@test.com") user.save() } }
saving entity works fine when through scaffolded pages provided grails.
what have missed?
if want integration tests shouldn't extend 1 of unit test base classes, change to
class usereventcontrollertests extends groovytestcase { ... }
and make sure it's in test/integration, not test/unit.
but looks want test controller (it's called usereventcontrollertests) should extend controllerunittestcase
. if that's case should doing unit tests, mocking domain layer (using mockdomain
, others) since want focus on controller logic, not persistence. test domain classes in proper integration tests using database.
this described in chapter 10 of docs: http://grails.org/doc/latest/
Comments
Post a Comment