2014-04-12 48 views
0


我使用Grails 2.3.3和Cucumber 0.10.0,我試圖創建此示例的更新版本創建該插件的作者:https://github.com/hauner/grails-cucumber/wiki/Testing-Grails-with-Cucumber-and-Geb
我遇到的問題是,與新的Grails appCtx不再綁定和黃瓜需要它。作者在他的github上發表評論如下:

「appCtx問題在於,它不再處於grails 2.3的綁定中,您可以使用Holders.applicationContext解決該問題,也可以使用Holders.applicationContext設置appCtx。這就是插件2.3版本將會增加我的舊例子的兼容性。「


我已經改變了CucumberTestType.groovy看起來像他在最新的分支版本。沒有這樣的屬性:appCtx類:groovy.lang.Binding - 黃瓜,Grails

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()) 
    } 
} 

但即使這樣,我仍然得到了同樣的錯誤:
Error executing script TestApp: cucumber.runtime.CucumberException: groovy.lang.MissingPropertyException: No such property: appCtx for class: groovy.lang.Binding (Use --stacktrace to see the full trace)

我誤解是什麼意思作家,因此錯過了什麼?

回答

0

我發佈了一個包含grails 2.3支持的插件的0.11.0-SNAPSHOT版本。

我也更新了示例項目(https://github.com/hauner/grails-cucumber/tree/master/test/projects)爲0.11.0-SNAPSHOT和grails 2.3.7。

geb示例現在使用最新版本的geb和webdriver。 ListPage中也有一個小的代碼更改。 url應該是book/index而不是book/list

要使用fork模式,至少需要grails 2.3.8。

希望能幫到:)

相關問題