Skip to content

Introduce time-bounded execution #402

@MaximilianAlgehed

Description

@MaximilianAlgehed

Right now the only conventient way to control how long a test runs for in QuickCheck is by modifying maxSuccess in one way or another. However, this is a bit inconvenient when setting up test suites (e.g. hspec) whose properties vary a lot in execution time.

It would be nice to have a flag (e.g. maxTestTime) that tells QuickCheck "please keep testing for this long" to avoid having to set different maxSuccess for different tests (and, more importantly, having to go through the slow and boring process of measuring execution time to figure out what it should be for each individual test!).

There are a couple of questions that need to be resolved when designing this feature, however:

  • How should it interact with withMaxSuccess?
    • The name maxSuccess aside the semantics of withMaxSuccess is currently that other things (checkCoverage) can make the tests run for more tests than maxSuccess and in keeping with this it would probably be correct to keep the same semantics here: run for the maximum of the allocated time and the given maxSuccess.
  • How should it interact with checkCoverage?
    • I think the right solution is probably to do what we do with maxSuccess and keep going even if the coverage checker is happy.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions