2014-09-11 24 views
5

Otrzymuję następujący błąd podczas uruchamiania testów Geb w IntelliJ IDE.Błąd podczas testów Cucumber Geb w IntelliJ IDE przy użyciu groovy

org.codehaus.groovy.runtime.InvokerInvocationException: groovy.lang.MissingMethodException: No signature of method: features.step_definitions.MyHomeStepDef.to() is applicable for argument types: (java.lang.Class) values: [class geb.pages.MyLandingPage] 
Possible solutions: is(java.lang.Object), run(), run(), any(), any(groovy.lang.Closure), with(groovy.lang.Closure) 
    at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:97) 
    at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233) 
    at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272) 
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:904) 
    at groovy.lang.Closure.call(Closure.java:415) 
    at cucumber.runtime.groovy.GroovyBackend.invoke(GroovyBackend.java:133) 
    at cucumber.runtime.groovy.GroovyStepDefinition.execute(GroovyStepDefinition.java:48) 
    at cucumber.runtime.StepDefinitionMatch.runStep(StepDefinitionMatch.java:45) 
    at cucumber.runtime.Runtime.runStep(Runtime.java:248) 
    ... 
    at cucumber.cli.Main.main(Main.java:12) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at java.lang.reflect.Method.invoke(Method.java:606) 
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120) 
    at ✽.Given I am on the My home page(D:\MyFolder\src\test\resources\features\my-login-page.feature:5) 
Caused by: groovy.lang.MissingMethodException: No signature of method: features.step_definitions.MyHomeStepDef.to() is applicable for argument types: (java.lang.Class) values: [class geb.pages.MyLandingPage] 
Possible solutions: is(java.lang.Object), run(), run(), any(), any(groovy.lang.Closure), with(groovy.lang.Closure) 
    at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:55) 
    at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:78) 
    at features.step_definitions.MyHomeStepDef$_run_closure1.doCall(MyHomeStepDef.groovy:25) 
    ..... 
    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 com.intellij.rt.execution.application.AppMain.main(AppMain.java:120) 

Wystąpił błąd w pliku definicji kroku podczas próby uzyskania dostępu do strony internetowej poprzez Geb

Given(~'^I am on the My home page$') { -> 

    to MyLandingPage 
    waitFor { at(MyLandingPage) } 
} 

Testy są doskonale działa w wierszu polecenia z gradle test polecenia

+0

To może wydawać się oczywiste, ale upewnij się, że dodałeś katalog, w którym znajdują się skrypty geb jako katalog "źródła testu". Więc jeśli rzeczy Geb są w src/groovy, kliknij prawym przyciskiem myszy i wybierz "Mark Directory As"> "Źródła źródeł testowych" –

Odpowiedz

0

w moim przypadku dodawania Browser Zamknięcie .drive naprawiło problem. Więc Przykładem może być:

Given(~'^I am on the My home page$') { -> 
    Browser.drive { 
     to MyLandingPage 
     waitFor { at(MyLandingPage) } 
    } 
} 
1

miałem ten sam problem i wreszcie znalazł rozwiązanie. Na podstawie przykładowego projektu https://github.com/geb/geb-example-cucumber-jvm.git należy się upewnić, że plik "env.groovy" jest również przywoływany na liście kleju w konfiguracji uruchamiania. cucumber-java settings Następnie BindingUpdater jest ładowany poprawnie, a wszystkie metody specyficzne dla geb są dostępne w pliku kroków podczas uruchamiania testów.

+0

czy istnieje sposób na uniknięcie konfigurowania intellij za każdym razem dla każdej funkcji? – Ankit

Powiązane problemy