Search code examples
scalacheck

How do you set the number of required succesful scalacheck tests


in munit scalacheck, how do I limit the number of inputs required to pass the test?


Solution

  • If your test extends munit.ScalaCheckSuite, there is a protected def scalaCheckTestParameters you can override to set the test parameters. A good way to set it is to modify the value in the base class, for example

    class MyTestSuite extends munit.ScalaCheckSuite {
      override val scalaCheckTestParameters = super.scalaCheckTestParameters.withMinSuccessfulTests(10)
    
      property("my property") {
        ...
      }
    }