4 Star 4 Fork 1

LJ / geb-sample

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
build.gradle 1.96 KB
一键复制 编辑 原始数据 按行查看 历史
LJ 提交于 2015-11-05 21:32 . gradle 中设置 chrome driver
import org.apache.tools.ant.taskdefs.condition.Os
group 'com.nikytwo'
version '1.0-SNAPSHOT'
ext {
// The drivers we want to use
drivers = ["firefox", "chrome"]
ext {
groovyVersion = '2.4.1'
gebVersion = '0.12.2'
seleniumVersion = '2.46.0'
chromeDriverVersion = '2.19'
phantomJsVersion = '1.9.7'
}
}
apply plugin: 'groovy'
apply plugin: 'java'
sourceCompatibility = 1.5
repositories {
// mavenCentral()
maven{ url 'http://maven.oschina.net/content/groups/public/'}
}
dependencies {
compile 'org.codehaus.groovy:groovy-all:2.3.11'
compile "org.gebish:geb-core:0.12.2"
compile "org.seleniumhq.selenium:selenium-firefox-driver:2.45.0"
compile "org.seleniumhq.selenium:selenium-chrome-driver:2.45.0"
compile "org.seleniumhq.selenium:selenium-ie-driver:2.45.0"
// compile "org.seleniumhq.selenium:selenium-htmlunit-driver:2.45.0"
compile "org.seleniumhq.selenium:selenium-support:2.45.0"
testCompile "org.gebish:geb-junit4:$gebVersion"
testCompile group: 'junit', name: 'junit', version: '4.11'
}
drivers.each { driver ->
task "${driver}Test"(type: Test) {
// reports {
// html.destination = reporting.file("$name/tests")
// junitXml.destination = file("$buildDir/test-results/$name")
// }
outputs.upToDateWhen { false } // Always run tests
systemProperty "geb.build.reportsDir", reporting.file("$name/geb")
systemProperty "geb.env", driver
// If you wanted to set the baseUrl in your build…
// systemProperty "geb.build.baseUrl", "http://myapp.com"
}
}
chromeTest {
def chromedriverFilename = Os.isFamily(Os.FAMILY_WINDOWS) ? "chromedriver.exe" : "chromedriver"
def chromedriverDir = file("$buildDir/resources/test")
systemProperty "webdriver.chrome.driver", new File(chromedriverDir, chromedriverFilename).absolutePath
}
test {
dependsOn drivers.collect { tasks["${it}Test"] }
enabled = false
}
Groovy
1
https://gitee.com/nikytwo/geb-sample.git
git@gitee.com:nikytwo/geb-sample.git
nikytwo
geb-sample
geb-sample
master

搜索帮助