GEB + Spock:没有方法签名
GEB + Spock: No signature of method
我正在尝试使用 GEB 和 Spock 编写一个简单的测试。以下是页面和规范测试:
第
页
import geb.Page
class DashboardPage extends Page {
static url = "?root=dashboard"
static at = { pageTitle.text() == "Dashboard Content Area" }
static content = {
pageTitle(wait: 25) { $("div#content-view-title>h1") }
leaderBoardPeriodCombo { $("#leaderboardPeriod") }
//manualsMenu { module(ManualsMenuModule) }
}
def selectLeaderBoardPeriod(periodValue) {
leaderBoardPeriodCombo.value(periodValue)
}
}
规格测试:
import geb.spock.GebSpec
import pages.DashboardPage
class LeaderboardSpec extends GebSpec {
def "change LeaderBoard type value"() {
when: to DashboardPage
then: at DashboardPage
when: DashboardPage.selectLeaderBoardPeriod("monthly")
then: at DashboardPage
}
}
但我收到以下错误:
groovy.lang.MissingMethodException:
No signature of method: static pages.DashboardPage.selectLeaderBoardPeriod() is applicable for argument types: (java.lang.String) values: [monthly]
Possible solutions: selectLeaderBoardPeriod(java.lang.String)
at specs.LeaderboardSpec.change LeaderBoard type value(LeaderboardSpec.groovy:13)
Results :
Tests in error:
LeaderboardSpec.change LeaderBoard type value:13 MissingMethod No signature of...
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
selectLeaderBoardPeriod 的签名有一个参数。我试图将类型明确定义为字符串,但我遇到了同样的错误。
有人能看出我做错了什么吗?
提前致谢。
此致
您的规范需要类似于:
class LeaderboardSpec extends GebSpec {
def "change LeaderBoard type value"() {
when:
def page = to DashboardPage
and:
page.selectLeaderBoardPeriod("monthly")
then:
at DashboardPage
}
}
我正在尝试使用 GEB 和 Spock 编写一个简单的测试。以下是页面和规范测试:
第
页import geb.Page
class DashboardPage extends Page {
static url = "?root=dashboard"
static at = { pageTitle.text() == "Dashboard Content Area" }
static content = {
pageTitle(wait: 25) { $("div#content-view-title>h1") }
leaderBoardPeriodCombo { $("#leaderboardPeriod") }
//manualsMenu { module(ManualsMenuModule) }
}
def selectLeaderBoardPeriod(periodValue) {
leaderBoardPeriodCombo.value(periodValue)
}
}
规格测试:
import geb.spock.GebSpec
import pages.DashboardPage
class LeaderboardSpec extends GebSpec {
def "change LeaderBoard type value"() {
when: to DashboardPage
then: at DashboardPage
when: DashboardPage.selectLeaderBoardPeriod("monthly")
then: at DashboardPage
}
}
但我收到以下错误:
groovy.lang.MissingMethodException:
No signature of method: static pages.DashboardPage.selectLeaderBoardPeriod() is applicable for argument types: (java.lang.String) values: [monthly]
Possible solutions: selectLeaderBoardPeriod(java.lang.String)
at specs.LeaderboardSpec.change LeaderBoard type value(LeaderboardSpec.groovy:13)
Results :
Tests in error:
LeaderboardSpec.change LeaderBoard type value:13 MissingMethod No signature of...
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
selectLeaderBoardPeriod 的签名有一个参数。我试图将类型明确定义为字符串,但我遇到了同样的错误。
有人能看出我做错了什么吗?
提前致谢。
此致
您的规范需要类似于:
class LeaderboardSpec extends GebSpec {
def "change LeaderBoard type value"() {
when:
def page = to DashboardPage
and:
page.selectLeaderBoardPeriod("monthly")
then:
at DashboardPage
}
}