jeudi 24 mars 2016

JUnit Test runs only ones

I have a simple JUnit test. If I run it everything works fine. If I try to run it right after the last time it's just ignoring the test and finish without doing the test. When I'm waiting a while, like 5 minutes, then it works fine again until I try to run it right after that try.

For my test I'm using groovy with gradle and it's a gebish test.

Is there somewhere a "trigger" that I have to change that I can run the test every time I want?

This is my testcase:

@RunWith(JUnit4)
class TestClass extends GebReportingTest {
    @Test
    void justATest() {
        go "http://ift.tt/gbk8l4"

        assert $("#h-top-questions").text() == "Top Questions"

        go "http://google.com"
    }
}

And this is my 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://ift.tt/1MDWbXr
    browserStack {
        def applicationAddresses = [8000, 8080, 8888, 9000, 9090].collect { "http://localhost:$it" }
        application(*applicationAddresses)

        forceLocal = true
        browsers {
            firefox_windows
        }
        account {
            username = browserstackUsername
            accessKey = browserstackKey
        }
    }
}

Aucun commentaire:

Enregistrer un commentaire