我正在尝试使用spock运行geb测试。我已经用groovy脚本编写了所有内容,该脚本放置在/src/main/groovy
中,如下所示
import spock.lang.Specification
import geb.Browser
import org.openqa.selenium.firefox.FirefoxDriver
class AccessCookieInFF{
...
}
class BrowserSpec extends Specification {
def CookieTest(){
given: ...
when: ...
then: ...
}
}
def newTest= new BrowserSpec()
newTest.CookieTest()
运行上面的设置给我
Exception in thread "main" groovy.lang.MissingMethodException: No signature of m
ethod: BrowserSpec.CookieTest() is applicable for argument types: () values: []
简单的groovy脚本与我的gradle设置运行良好。有人可以指出,这是怎么了。谢谢!
最佳答案
通过将groovy测试文件放置在/src/test/groovy
中并按照下面的链接对build.gradle
文件进行一些更改并通过命令gradle test
运行它,可以完成此工作。现在,测试文件如下所示(出于其他原因,我删除了class AccessCookieInFF
)
import spock.lang.Specification
import geb.Browser
import org.openqa.selenium.firefox.FirefoxDriver
class BrowserSpec extends Specification {
def cookieTest(){
given: ...
when: ...
then: ...
}
}
This非常有帮助。谢谢
关于groovy - 使用Gradle运行Spock/Geb测试时出现MissingMethodException错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29478530/