Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 394
ayvango Avatar asked Oct 31 '22 18:10

ayvango


1 Answers

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.

like image 185
rickynils Avatar answered Nov 08 '22 12:11

rickynils