wasyl
11/07/2019, 12:06 PMlateinit
keyword, while setting stuff from closures will often make it necessaryjulian
11/07/2019, 2:59 PMsam
11/07/2019, 3:54 PMjulian
11/07/2019, 4:08 PMsam
11/07/2019, 4:09 PMjulian
11/07/2019, 4:10 PMsam
11/07/2019, 4:11 PMsam
11/07/2019, 4:11 PMjulian
11/07/2019, 4:18 PMsam
11/07/2019, 4:18 PMsam
11/07/2019, 4:18 PMval database = setup()
test("test 1") {
...
}
database.stop()
sam
11/07/2019, 4:18 PMtest("outer test") {
val database = setup()
test("inner test scope") {
...
}
database.stop()
}
sam
11/07/2019, 4:19 PMjulian
11/07/2019, 4:25 PMsam
11/07/2019, 4:26 PMsam
11/07/2019, 4:27 PMsam
11/07/2019, 4:27 PMjulian
11/07/2019, 4:34 PMwasyl
11/07/2019, 4:38 PMThey’re just an artificial construct because of limitations in other frameworks.At the same time they are quite helpful (imo) in terms of readability. Having setup and cleanup code in one place is a plus for me
sam
11/07/2019, 4:49 PMjulian
11/07/2019, 11:55 PMIn KotlinTest there is fun beforeTest(testCase: TestCase) that we can override, but it's global for all test cases in spec, and not scoped. This means we can't access data defined in the context for example.It's been a while since I used Spek, so I'd need to verify, but I think it supports scoped fixtures.
wasyl
11/08/2019, 8:53 AM