Search code examples
scalaspecs2scalacheck

Is it possible to specify at the site of a Property definition how many times to execute the Property?


Such as this:

class MySpec extends Specification with ScalaCheck { def is = s2"""
  MyThing should
    do something the right way $x1
                                """
    def x1 = prop(4 /*times*/) { (...) =>
      ...
    }
  }
}

Solution

  • Use setParameters and minTestsOk:

    class MySpec extends Specification with ScalaCheck { def is = s2"""
      MyThing should
        do something the right way $x1
                                    """
        def x1 = prop { (...) =>
          ...
        }.set(minTestsOk = 1)
      }
    }