我有一个简单的JUnit测试。 如果我运行它一切正常。如果我在最后一次尝试运行它,它只是忽略测试并完成而不进行测试。当我等待一段时间,比如5分钟时,它再次正常工作,直到我尝试在尝试之后立即运行它。
对于我的测试,我正在使用常规的gradle,这是一个垃圾测试。
是否有某个“触发器”我需要更改,我可以每次都运行测试?
这是我的测试用例:
@RunWith(JUnit4)
class TestClass extends GebReportingTest {
@Test
void justATest() {
go "http://stackoverflow.com"
assert $("#h-top-questions").text() == "Top Questions"
go "http://google.com"
}
}
这是我的build.gradle:
def browserstackUsername = ""
def browserstackKey = ""
apply plugin: 'groovy'
def gebVersion = '0.13.1'
def seleniumVersion = '2.51.0'
repositories {
mavenCentral()
}
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.gebish:geb-gradle:0.13.1'
}
}
dependencies {
testCompile "org.gebish:geb-gradle:$gebVersion"
testRuntime "org.seleniumhq.selenium:selenium-support:$seleniumVersion"
testCompile "org.gebish:geb-junit4:$gebVersion"
testCompile "org.seleniumhq.selenium:selenium-firefox-driver:$seleniumVersion"
}
task firefoxTest(type: Test) {
systemProperty "geb.build.reportsDir", reporting.file("$name/geb")
systemProperty "geb.env", "firefox"
}
task browserstackTest(type: Test){
systemProperty "geb.build.reportsDir", reporting.file("$name/geb")
systemProperty "geb.env", "browserstack"
apply plugin: "geb-browserstack"
// Config: http://www.gebish.org/manual/current/#geb-browserstack-plugin
browserStack {
def applicationAddresses = [8000, 8080, 8888, 9000, 9090].collect { "http://localhost:$it" }
application(*applicationAddresses)
forceLocal = true
browsers {
firefox_windows
}
account {
username = browserstackUsername
accessKey = browserstackKey
}
}
}