import spock.lang.Specification
import grails.testing.web.controllers.ControllerUnitTest
class HelloControllerTests extends Specification implements ControllerUnitTest<HelloController> {
void "Test message action"() {
when:"The message action is invoked"
controller.message()
then:"Hello is returned"
response.text == 'Hello'
}
}
1.1.3 New Testing Framework
Version: 3.3.8
1.1.3 New Testing Framework
Grails 3.3 includes a new Trait-based testing framework that replaces the existing @TestMixin
based framework with a simpler implementation that is easier to debug, provides better code completion and is easier to extend.
An example hello world test can be seen below: