ayvango
ayvango

Reputation: 5977

How to specify number of checks to the forAll method in property checks

The forAll method takes generator(s) and performs number of checks of them. 100 checks by generator passed by default. Number of runs multiplied and you may quickly get too large if you use multiple generators.

I'd like to sort generators based on they significance and give irrelevant less checks. So I need to specify somehow how many runs of each generator is required. I looked into API for generators and for forAll method but found no clues. Neither of them take parameters that may specify check running behavior.

scalatest provides wrapper for the scalacheck's forAll method. So I'm searching solution either for a wrapper or for a original.

Upvotes: 5

Views: 740

Answers (1)

Rickard Nilsson
Rickard Nilsson

Reputation: 1443

No matter how many generators you use, ScalaCheck will only run 100 (by default) tests. The forAll method doesn't know anything about how many tests to run, it will only evaluate a property one time. Test.check will call forAll the specified number of times.

Upvotes: 2

Related Questions