Grails claims that it encourages writing test – for example, a test class is created every time you create a controller or domain. However, working on my first Grails project I find it quite confusing which kind of test supports what.
For example, we use GreenMail in our testing environment. To check for sent mails, we have to use GrailsUnitTests, even if we are testing a Controller, because the content of mails is always empty in ControllerUnitTests.
Checking view names or redirects in those two types of tests is also slightly different:
-
//ControllerUnitTest
-
assert controller.modelAndView.view == "send"
-
assert controller.redirectArgs.controller == "delivery"
-
//GrailsUnitTests
-
assert controller.modelAndView.view == "Message/send"
-
assert controller.response.redirectUrl == "/delivery"
This is pretty annoying and I hope it will be unified in future versions of Grails.



