withFixtureGenerator
fun <T> <Error class: unknown class>.withFixtureGenerator(generator: () -> T): <Error class: unknown class>(source)
Prepares a fixture-generating scope from a generator function.
Use as follows:
val aGeneratingSuite by testSuite {
withFixtureGenerator { Random.nextBytes(32) } - {
test("A Test with fresh Randomness") { freshFixture ->
//your test logic here
}
repeat(100) {
test("A Test with fresh Randomness") { freshFixture ->
//some more test logic; each call gets fresh randomness
}
}
}
}Content copied to clipboard
Parameters
T
The type of fixture object being managed
generator
The generator function invoked to provide fresh state fo each test
fun <T> <Error class: unknown class>.withFixtureGenerator(generator: suspend () -> T): <Error class: unknown class>(source)
Prepares a fixture-generating scope from a generator function.
Use as follows:
val aGeneratingSuite by testSuite {
withFixtureGenerator(suspend { Random.nextBytes(32) }) - {
test("A Test with fresh Randomness") { freshFixture ->
//your test logic here
}
repeat(100) {
test("A Test with fresh Randomness") { freshFixture ->
//some more test logic; each call gets fresh randomness
}
}
}
}Content copied to clipboard
Parameters
T
The type of fixture object being managed
generator
The generator function invoked to provide fresh state fo each test