froi
froi

Reputation: 7768

grails generated unit tests failing right after generation

Currently using grails 2.3.7

Does generated unit tests of grails normally fails after generating?(generate-all)

I noticed that after I scaffolded, some of the generated controller unit tests are failing. Is this normal?

Upvotes: 1

Views: 67

Answers (1)

dmahapatro
dmahapatro

Reputation: 50245

Yes, this is expected. It is expected that a valid field is present in the domain class under test. For example, a domain class Foo:

class Foo {
    String name
}

also it is expected that dev is implementing the TODO part in the generated spec. In case of the generated FooControllerSpec, this is where the changes needs to be done, populating valid properties for aforementioned Foo domain:

def populateValidParams(params) {
    assert params != null
    // TODO: Populate valid properties like...
    params["name"] = 'someValidName'
}

Upvotes: 3

Related Questions