Skip to content

Instantly share code, notes, and snippets.

@hoangtranwork
Created July 13, 2016 04:27
Show Gist options
  • Save hoangtranwork/8166d7c7d1202d3113ddb835f82f014e to your computer and use it in GitHub Desktop.
Save hoangtranwork/8166d7c7d1202d3113ddb835f82f014e to your computer and use it in GitHub Desktop.
with invocation set, before/after hook seems to not run correctly around `each` invocation
package kotlintest.playground
import io.kotlintest.KTestJUnitRunner
import io.kotlintest.specs.StringSpec
import org.junit.runner.RunWith
/**
* Created by hoang on 7/13/16.
*/
@RunWith(KTestJUnitRunner::class)
class InvocationExample : StringSpec() {
override val oneInstancePerTest = true
override fun beforeAll() {
println("====beforeAll run ${Thread.currentThread().name}")
}
override fun afterAll() {
println("====afterAll run ${Thread.currentThread().name}")
}
override fun beforeEach() {
println("====beforeEach run ${Thread.currentThread().name}")
}
override fun afterEach() {
println("====afterEach run ${Thread.currentThread().name}")
}
init {
println("==init run ${Thread.currentThread().name}")
"a test that run multiple times" {
println("======test run ${Thread.currentThread().name}")
}.config(invocations = 3)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment