【发布时间】:2011-08-14 09:37:25
【问题描述】:
我在 Grails 中使用 webflow,目前正在为它编写测试。现在,在里面我有一些东西会引发错误,所以我在重定向之前设置了一条消息到 flash 范围:
...
if (some_condition) {
flash.message = "my error message"
return error()
}
...
现在,我知道当我要在 GSP 页面中显示它时,我会以如下方式访问 flash 消息
<g:if test="${message}">...
而不是通常的
<g:if test="${flash.message}">...
所以无论如何,我正在编写我的测试,我想知道如何测试消息的内容?通常,在控制器的正常操作中,我遵循here 中所写的内容。但是,由于这是一个网络流,即使我检查 controller.flash.message / controller.params.message / controller.message ,我似乎也找不到该消息。我也试过查看流量范围...
关于如何查看消息的任何想法?非常感谢!
【问题讨论】:
标签: testing grails spring-webflow