grails - 在所有功能测试运行之前 Hook

标签 grails

是否有可能在运行所有 grails 功能测试之前获得预提交?这意味着如果你有 100 个功能测试,这个钩子(Hook)会被调用一次。

谢谢

最佳答案

是的,使用 Bootstrap 。

import grails.util.Environment

class BootStrap {  

    def init = { servletContext ->
        if (Environment.current == Environment.TEST) {
            // test setup here
        }
    }

    def destroy = {
        // teardown here (if necessary)
    }
}

这将在应用程序以测试模式启动后运行,这是您想要的

关于grails - 在所有功能测试运行之前 Hook ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31828067/

相关文章:

grails - GORM/深层次的不同关联查询条件

hibernate - Grails GORM Rest 插件和 Hibernate

ajax - 需要有关使用 Grails 和 Ajax 附加到像 Rails 中的 div 的建议

grails - 如何在Grails中实现基于权限的访问控制?

Grails 3 - 更改运行应用程序的默认端口

CSS @import 语句

grails - 在服务器上生成的Grails spring-security-rest JWT token 与在客户端上收到的 token 不匹配

grails - 引用其他grails项目

Grails 3.0 错误,空指针

grails - 创建Grails插件,应用程序看不到类