dimanche 8 avril 2018

Spek unexpected order execution

how can I execute val chromeDriver = setupChromeDriverForTest() only once? I was expected that it happens if I put it in given section, but It is called twice (with single test as you see). So I get an exception (File is using by another process), because the setupChromeDriverForTest() method loads File.

@RunWith(JUnitPlatform::class)
class ChromeDriverConfigurationTest : Spek
({

    given("chrome_driver") {
            val chromeDriver = setupChromeDriverForTest()
        on("fetching js text") {
            val path = ChromeDriverConfigurationTest::class.java.getResource("js/js.html").path
            val text = fetchTextAndDeleteDriver(chromeDriver, path)
            it("should find text") {
                assert(text == "Text from JS!")
            }
        }
    }
})

Aucun commentaire:

Enregistrer un commentaire