我正在按照http://www.gebish.org/manual/0.9.2/sauce-labs.html#gradle_geb_saucelabs_plugin的示例进行操作,但无法使其正常运行。我的build.gradle脚本如下:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath "org.grails:grails-gradle-plugin:2.0.0"
classpath 'org.gebish:geb-gradle:0.9.2'
}
}
version "0.1"
group "example"
apply plugin: "grails"
apply plugin: "geb-saucelabs"
repositories {
grails.central() //creates a maven repo for the Grails Central repository (Core libraries and plugins)
maven { url "http://repository-saucelabs.forge.cloudbees.com/release" }
}
grails {
grailsVersion = '2.3.5'
groovyVersion = '2.1.9'
springLoadedVersion '1.1.3'
}
dependencies {
bootstrap "org.grails.plugins:tomcat:7.0.50" // No container is deployed by default, so add this
compile 'org.grails.plugins:resources:1.2' // Just an example of adding a Grails plugin
sauceConnect "com.saucelabs:sauce-connect:3.0.28"
}
sauceLabs {
browsers { //5
firefox_linux_19 //Could not find property 'reporting' on root project 'gradleGrailsError'.
chrome_mac
internetExplorer_vista_9
}
task { //6
testClassesDir = test.testClassesDir
testSrcDirs = test.testSrcDirs
classpath = test.classpath
}
account { //7
username = System.getenv("SAUCE_ONDEMAND_USERNAME")
accessKey = System.getenv("SAUCE_ONDEMAND_ACCESS_KEY")
}
}
当我运行
$gradle test
时,出现以下错误:在根项目上找不到属性“reporting” ...在将firefox_linux_19指定为浏览器的行上发生此错误。有人可以建议我如何使geb-saucelabs插件正常工作吗?谢谢。
最佳答案
经过大量的反复试验,我可以进行以下工作:
sauceLabs {
tasks.withType(Test) {
reports.junitXml.destination = reporting.file("test-results/$name")
reports.html.destination = reporting.file("test-reports/$name")
}
browsers { //5
firefox_linux_19
chrome_mac
internetExplorer_vista_9
}
account { //7
username = System.getenv("SAUCE_ONDEMAND_USERNAME")
accessKey = System.getenv("SAUCE_ONDEMAND_ACCESS_KEY")
}
}
添加task.withType(Test)是关键,并且我还删除了示例代码中列出的任务关闭。
关于grails - Gradle Geb saucelabs插件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22602959/