with Fixture Generator
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> TestSuite.withFixtureGenerator(generator: suspend () -> T): GeneratingSuspendFixtureScopHolder<T>
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