用grails设置黄瓜插件2.3.8

时间:2015-01-22 16:10:07

标签: grails cucumber grails-plugin

我正在尝试使用grails 2.3.8安装cucumber plugin。这是我的BuildConfig.groovy

dependencies {
    test "org.seleniumhq.selenium:selenium-support:2.43.1"
    test "org.seleniumhq.selenium:selenium-safari-driver:2.43.1"
    test "org.seleniumhq.selenium:selenium-ie-driver:2.43.1"
    test "org.seleniumhq.selenium:selenium-chrome-driver:2.43.1"
    test "org.seleniumhq.selenium:selenium-firefox-driver:2.43.1"
    test "org.gebish:geb-spock:0.9.3"
    compile ":cucumber:1.0.1"
}

plugins {
    build ":tomcat:7.0.52.1"
    test ":cucumber:1.0.1"

    compile ":scaffolding:2.0.2"
    compile ':cache:1.1.1'
    compile ":rest-client-builder:2.0.1"
    compile ":geb:0.9.3"

    // plugins needed at runtime but not for compilation
    runtime ":hibernate:3.6.10.9" // or ":hibernate4:4.3.4"
    runtime ":database-migration:1.3.8"
    runtime ":jquery:1.11.0.2"
    runtime ":resources:1.2.7"
}

测试/ CukeTest.feature

Feature: Cucumber itself
  Cucumber can launch a browser and run tests

  Scenario: It launches a browser
    Given I see the browser
    When I type "Hello" into the "blah" field
    Then I see "Hello" in the "blah" field

当我尝试编译时,我收到以下错误

> grails compile
| Loading Grails 2.3.8
| Error There was an error loading the BuildConfig: Bad artifact coordinates 
:cucumber:1.0.1, expected format is 
<groupId>:<artifactId>[:<extension>[:<classifier>]]:<version>
(Use --stacktrace to see the full trace)

grails cucumber插件页面似乎表明你确实需要添加它抱怨的编译依赖项(compile ":cucumber:1.0.1"),但是我看到了一个示例项目(使用早期版本的grails)没有指定编译依赖项,因此我从BuildConfig中删除了它。这使得它可以编译,但在尝试运行测试时出现以下错误。

> grails test-app :cucumber
| Error Fatal error running tests: No such field:     
$spock_sharedField__browser for class: org.codehaus.groovy.runtime.NullObject

C:\workspaces\compose\jmendes_casper_compose\rad\compose\trunk\compose-automation>grails test-app :cucumber --stacktrace --verbose --debug
Base Directory: C:\workspaces\compose\jmendes_casper_compose\rad\compose\trunk\compose-automation
| Environment set to test.....
    [mkdir] Created dir: C:\workspaces\compose\jmendes_casper_compose\rad\compose\trunk\compose-automation\target\test-reports\html
| Server running. Browse to http://localhost:8080/compose-automation
| Server stopped
| Error Fatal error running tests: No such field: $spock_sharedField__browser for class: org.codehaus.groovy.runtime.NullObject
groovy.lang.MissingFieldException: No such field: $spock_sharedField__browser for class: org.codehaus.groovy.runtime.NullObject
        at groovy.lang.MetaClassImpl.getAttribute(MetaClassImpl.java:2631)
        at groovy.lang.MetaClassImpl.getAttribute(MetaClassImpl.java:3469)
        at org.codehaus.groovy.runtime.InvokerHelper.getAttribute(InvokerHelper.java:142)
        at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.getField(ScriptBytecodeAdapter.java:302)
        at geb.spock.GebSpec.get_browser(GebSpec.groovy)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
        at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:1725)
        at groovy.lang.ExpandoMetaClass.getProperty(ExpandoMetaClass.java:1140)
        at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:3461)
        at groovy.lang.ExpandoMetaClass.getProperty(ExpandoMetaClass.java:1152)
        at org.codehaus.groovy.runtime.callsite.PogoMetaClassGetPropertySite.getProperty(PogoMetaClassGetPropertySite.java:48)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:231)
        at geb.spock.GebSpec.getBrowser(GebSpec.groovy:40)
        at geb.spock.GebSpec.propertyMissing(GebSpec.groovy:62)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
        at groovy.lang.MetaClassImpl.invokeMissingProperty(MetaClassImpl.java:782)
        at groovy.lang.MetaClassImpl.setProperty(MetaClassImpl.java:2551)
        at groovy.lang.ExpandoMetaClass.setProperty(ExpandoMetaClass.java:1170)
        at groovy.lang.MetaClassImpl.setProperty(MetaClassImpl.java:3465)
        at org.codehaus.groovy.runtime.InvokerHelper.setProperties(InvokerHelper.java:463)
        at org.codehaus.groovy.runtime.InvokerHelper.createScript(InvokerHelper.java:440)
        at groovy.lang.GroovyShell.parse(GroovyShell.java:625)
        at groovy.lang.GroovyShell.parse(GroovyShell.java:605)
        at cucumber.runtime.groovy.GroovyBackend.parse(GroovyBackend.java:106)
        at cucumber.runtime.groovy.GroovyBackend.loadGlue(GroovyBackend.java:70)
        at cucumber.runtime.Runtime.<init>(Runtime.java:88)
        at cucumber.runtime.Runtime.<init>(Runtime.java:66)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
        at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77)
        at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:202)
        at grails.plugin.cucumber.CucumberTestType.prepareCucumber(CucumberTestType.groovy:74)
        at grails.plugin.cucumber.CucumberTestType.doPrepare(CucumberTestType.groovy:51)
        at org.codehaus.groovy.grails.test.support.GrailsTestTypeSupport.prepare(GrailsTestTypeSupport.groovy:98)
        at org.codehaus.groovy.grails.test.runner.GrailsProjectTestRunner.runTests(GrailsProjectTestRunner.groovy:405)
        at 
| Error Error executing script TestApp: groovy.lang.MissingFieldException: No such field: $spock_sharedField__browser for class: org.codehaus.groovy.runtime.NullObject

对于任何愚蠢的错误感到抱歉,第一次尝试安装grails插件。这是版本问题吗?

0 个答案:

没有答案