advancedtelematic / quickcheck-state-machine

Test monadic programs using state machine based models
Other
203 stars 25 forks source link

`forAllCommands` generating fewer commands than expected #299

Closed m-alvarez closed 5 years ago

m-alvarez commented 5 years ago

I'm using the library to run some tests that crucially depend on the amount of generated commands (for example, say, they will always fail if less than 10 commands have been executed, for internal reasons), and I've found that even if I give forAllCommands a large lower bound for the number of commands in a run, in some cases my tests fail because only one or two commands were generated.

I've written a minimum example to check how many commands the library is generating (see here) and it seems like the generated traces vary in size between 20 and 100 - even when giving QuickCheck a larger size parameter, this only seems to affect the maximum number of commands, but not the minimum, which is always lower than 100 - am I missing something? If not, is there any way to make sure every generated sequence of commands has a certain minimum length (other than discarding the shorter ones)?

stevana commented 5 years ago

I recently fixed a bug related to this problem, please try using master instead.

stevana commented 5 years ago

If that fixes the problem, I can try to make a new release soon.

If you need more fine grained control of how programs are generated, you can also have a look at the Markov module and the process registry example that uses it.

m-alvarez commented 5 years ago

Switching to master fixed it, thanks!