I recently upgraded a project from 2.2 to 2.4.4, and upgraded the integration tests by replacing
IntegrationTest extends GroovyTestCase
with
@TestMixin(IntegrationTestMixin)
My controllers have save methods e.g. :
class IssueController {
def save() {
...
if (!issueService.save(issue)) {
render(view: "create", model: [issueInstance: issue])
return
}
}
and the integration test (in test/integration) :
@Before
void setUp() {
ic = new IssueController()
}
@Test
void testValidSave() {
ic.params.issueNo = "test"
ic.save()
assert ic.flash.successAlert == "Saved issue test"
assert ic.response.redirectUrl == '/issue/list'
}
but my Integrations tests, when calling ic.save() don't call the controller save method (and so fail). If I rename the save() method to say saveIt(), and the call to ic.saveIt(), everything works fine
but I don't want to have to rename all my controller method names.
Aucun commentaire:
Enregistrer un commentaire