我的测试框架有什么问题,我无法运行测试?
我的 build.gradle
SELECT t.*, m.docform
FROM mydocs m
INNER JOIN LATERAL
xpath_table('id','content','mydocs',
'/tutorial/author|/tutorial/title',
'true')
AS t(id int, author text, title text) ON m.id = t.id
我的 GebConfig.groovy
version '1.0-SNAPSHOT'
//task wrapper(type: Wrapper) {
// gebVersion = '0.13.1'
// seleniumVersion = '2.52.0'
//
// distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip"
//}
apply plugin: 'groovy'
repositories {
mavenCentral()
}
sourceCompatibility = 1.5
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.11'
// geb
compile 'org.codehaus.geb:geb-core:0.7.2'
compile 'org.codehaus.geb:geb-spock:0.7.2'
compile "org.seleniumhq.selenium:selenium-firefox-driver:2.52.0"
compile "org.seleniumhq.selenium:selenium-chrome-driver:2.52.0"
compile "org.seleniumhq.selenium:selenium-safari-driver:2.52.0"
compile "org.seleniumhq.selenium:selenium-support:2.52.0"
// spock
compile "org.codehaus.groovy:groovy-all:2.4.1"
testCompile "org.spockframework:spock-core:1.0-groovy-2.4"
}
页面类
//import geb.driver.SauceLabsDriverFactory
import org.openqa.selenium.chrome.ChromeDriver
import org.openqa.selenium.firefox.FirefoxDriver
import org.openqa.selenium.safari.SafariDriver
//baseUrl = 'http://madison.craigslist.org'
// default driver...
System.setProperty('webdriver.chrome.driver', "../resources/chromedriver")
driver = {new ChromeDriver()}
environments {
'chrome' {
def chromeDriver = new File('src/test/resources/chromedriver') // add .exe for Windows...
System.setProperty('webdriver.chrome.driver', chromeDriver.absolutePath)
driver = { new ChromeDriver() }
}
// 'ff' {
// driver = { new FirefoxDriver() }
// driver.manage().window().maximize()
// }
'safari' {
driver = { new SafariDriver() }
}
}
waiting {
timeout = 6
retryInterval = 0.5
slow { timeout = 12 }
reallySlow { timeout = 24 }
}
reportsDir = "geb-reports"
测试类
package pages
import geb.Page
import geb.Browser
class LoginPage extends Page{
static url = "https://qmdev.quickblox.com"
// static at = {heading.isDisplayed()}
static at = {title == "Q-municate"}
static content = {
heading {$("div#l-welcome_block l-welcome_text_description")}
logInByEmailOrSocial {$("button", text:"login by email or social")}
logInPageTitle {$("div.l-welcome_block l-welcome_text_login")}
}
}
关于我的框架: 我使用web-spock-groovy-gradle bundle进行Web UI自动化,并且我是Gradle的新用户。 请告诉我,我的build.gradle和GebConfig.groovy有什么问题。
答案 0 :(得分:0)
您的Geb-Spock版本0.7.2已经很老了,可能是您遇到问题的原因。我建议将这两个依赖项更改为1.1.1版:
res/drawable-mdpi/
更多我检查Spock API版本1.1 for" org / spockframework / mock / MockController"它似乎不存在。
(http://spockframework.org/spock/javadoc/1.1-SNAPSHOT/index.html) 正如你在这张图片中看到的那样,只有2个类是spock.mock包的一部分,而MockController不是其中之一。尝试更新您的geb版本,如果有帮助,请告知我们