没有这样的属性:类的appCtx:groovy.lang.Binding-Cucumber,Grails

没有这样的属性:类的appCtx:groovy.lang.Binding-Cucumber,Grails,grails,cucumber,Grails,Cucumber,我正在使用Grails 2.3.3和Cucumber 0.10.0,并试图创建插件作者创建的该示例的更新版本: 我遇到的问题是,有了新的Grails,appCtx不再绑定,cucumber需要它。作者在他的github中对此进行了评论: “appCtx的问题是,它不再在grails 2.3的绑定中。您可能可以使用Holders.applicationContext或使用Holders.applicationContext设置appCtx。这就是插件2.3版本将要做的,以增加与我以前的示例的兼


我正在使用Grails 2.3.3和Cucumber 0.10.0,并试图创建插件作者创建的该示例的更新版本:
我遇到的问题是,有了新的Grails,appCtx不再绑定,cucumber需要它。作者在他的github中对此进行了评论:

“appCtx的问题是,它不再在grails 2.3的绑定中。您可能可以使用Holders.applicationContext或使用Holders.applicationContext设置appCtx。这就是插件2.3版本将要做的,以增加与我以前的示例的兼容性。”

我已经更改了CucumberTestType.groovy,使其看起来像最新的branch版本中的CucumberTestType.groovy

private Binding createBinding () {
    Map variables = buildBinding.variables.clone () as Map
    variables.remove ("metaClass")
    variables.remove ("getMetaClass")
    variables.remove ("setMetaClass")
    setAppCtx (variables)
    setFunctionalTestBaseUrl (variables)
    new Binding (variables)
}

private void setAppCtx (Map variables) {
    // appCtx is no longer available in the (test-app) binding since grails 2.3

    // for plugin backward compatibility we add it if possible, i.e. not forked!
    if (!forked && !variables.containsKey('appCtx')) {
        variables.put('appCtx', getApplicationContext())
    }
}
但即使在这之后,我仍然会得到相同的错误:
执行脚本TestApp:cucumber.runtime.CucumberException:groovy.lang.MissingPropertyException:没有这样的属性:类的appCtx:groovy.lang.Binding(使用--stacktrace查看完整跟踪)


我是否误解了作者的意思,因此遗漏了什么?

我发布了包含grails 2.3支持的插件的0.11.0-SNAPSHOT版本

我还将示例项目()更新为0.11.0-SNAPSHOT和Grails2.3.7

geb示例现在使用最新版本的geb和webdriver。
列表页
中还有一个小的代码更改。
url
应该是
book/index
,而不是
book/list

要使用fork模式,您至少需要Grails2.3.8

希望有帮助:)