UserControllerこのコントローラーには、register()サービスを使用してユーザーを登録し、出力をレンダリングするメソッドがあります。
私は Grails Cucumber プラグインを使用しており、UserController オブジェクトを作成し、params を設定し、呼び出しますuserControllerObj.register()
キュウリ テストの "Then" 部分で呼び出すことができます。userController.response.contentAsString()これは、UserController でrender "some text here".
ただし、UserController register メソッドでレンダリングを文字列のレンダリングからページのレンダリングに変更するとrender(view: "registrationOK")、出力を取得できません。
userController.responseですGrailsMockHttpServletResponse
userController.response.getText returns空の文字列
userController.response.contentAsString空の文字列を返します
userController.response.contentTypetext/html を返します;charset=utf-8
userController.response.contentLength0 を返します
userController.modelAndView.viewnull を返します