2

IntelliJ 内の Grails プロジェクトでいくつかの geb テストを実行しようとしていますが、問題が発生しており、2 日間の Web 検索の後、別のことを試してもまだスタックしています。以前はいくつかの Groovy テストが正常に実行されていましたが、geb では今のところ運がありません。cucumber-jvm を使用しています。

現在、次のエラーが発生しています: スクリプト TestApp の実行中にエラーが発生しました: groovy.lang.MissingMethodException: メソッドの署名がありません: GebConfig.environments() は引数の型に適用できます: (GebConfig$_run_closure2) 値: [GebConfig$_run_closure2@4ad3727e]

私の GebConfig.groovy ファイルはテスト/機能中で、以下が含まれています。

import org.openqa.selenium.htmlunit.HtmlUnitDriver
import org.openqa.selenium.firefox.FirefoxDriver
import org.openqa.selenium.chrome.ChromeDriver

// Use htmlunit as the default
// See: http://code.google.com/p/selenium/wiki/HtmlUnitDriver
driver = {
    def driver = new HtmlUnitDriver()
    driver.javascriptEnabled = true
    driver
}

environments {Not sure 
    chrome {-Dgeb.env=chrome
        driver = { new ChromeDriver() }
    }
    firefox {
        driver = { new FirefoxDriver() }
    }
}

テスト/機能にも.featureファイルがあります。ステップ定義は test/functional/steps にあり、以下が含まれます。

package steps

import geb.*

this.metaClass.mixin (cucumber.runtime.groovy.EN)
this.metaClass.mixin (cucumber.runtime.groovy.Hooks)

def browser = new Browser()

Given (~"I am on the front page") {
    browser.go("http://localhost:8081/whereisOne")
}

test/functional/setup には、Groovy テスト用に作成された shared_driver.groovy クラスもありますが、これがまだ必要かどうかはわかりません。

実行構成コマンドは次のとおりです: test-app --stacktrace、VM オプション: -Dgeb.env=chrome

どんな助けでも感謝します、ありがとう!

4

1 に答える 1

0

-Dgeb.env=chrome はコードに含まれていますか? その場合は、この行を削除する必要があります。他のすべては問題ないように見えます。

于 2013-01-17T10:55:39.180 に答える