Configuration
#
ConfigurationKotest provides for the ability to specify some configuration options when running a property test. We do this by passing
in an instance of PropTestConfig
to the test methods.
For example:
#
SeedThe most common configuration option is specifying the seed for the random instance. This is used when you want to reliably create the same values each time the test is run. You might want to do this if you find a test failure, and you want to ensure that that particular set of values continues to be executed in the future as a kind of regression test.
tip
Whenever a property test fails, Kotest will output the seed that was used. You can duplicate the test, setting it to use this seed so you have permanent regression test for those values.
For example:
#
Min FailureBy default, Kotest tolerates no failure. Perhaps you want to run some non-deterministic test a bunch of times, and you're happy to accept some small number of failures. You can specify that in config.
#
PropTestListenerSometimes in property test it is required to perform some setup and tear down in each iteration of test.
For this purpose you can register a PropTestListener
with PropTestConfig
.