Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option for printing the number of QuickCheck tests and shrinks #431

Merged

Conversation

jorisdral
Copy link
Contributor

Currently, tasty and tasty-quickcheck will print a progress percentage, so one can see test progression. However, once a property finds a failure and starts shrinking, then test progression stops. Importantly, it is not clear how the shrinker is progressing, though it would be useful information to show, e.g., to judge whether a test is shrinking too slow, whether the shrinker loops, or whether a shrunk test case hangs. This commit adds a new option to enable printing the number of QuickCheck tests (and shrinks on test failure) in addition to the percentage.

I know this feature has been suggested before here: #419 (comment)). In my opinion it would be a generally useful feature to include, and it's optional so that it does not use up too much UI space by default. Let me know what you think!

@Bodigrim
Copy link
Collaborator

@jorisdral I'm keen to avoid adding more command-line options. The interface is already quite cluttered.

I'd prefer the following behaviour to be implemented unconditionally: firstly show progress from 0% to 100% while testing (progressText is empty, progressFloat is non-zero), then show number of shrinks (progressText is "XX shrink", progressFloat is zero).

@Bodigrim
Copy link
Collaborator

@jorisdral what do you think about my suggestion above?

No promises, but we might be making a release soon; it would be great if this improvement lands before that.

@jorisdral
Copy link
Contributor Author

@Bodigrim I think your suggestion makes sense. I'll see if I can adjust the PR soon

@jorisdral
Copy link
Contributor Author

@Bodigrim I've updated the PR. Let me know if this is what you had in mind

quickcheck/Test/Tasty/QuickCheck.hs Outdated Show resolved Hide resolved
quickcheck/Test/Tasty/QuickCheck.hs Outdated Show resolved Hide resolved
Currently, `tasty` and `tasty-quickcheck` will print a progress percentage, so
one can see test progression. However, once a property finds a failure and
starts shrinking, then test progression stops. Importantly, it is not clear how
the shrinker is progressing, though it would be useful information to show,
e.g., to judge whether a test is shrinking too slow, whether the shrinker loops,
or whether a shrunk test case hangs. This commit changes the progress bar to
print the number of shrinks in case of test failures. Succesful tests will still
print the progress percentage.
@Bodigrim Bodigrim merged commit 7efa34a into UnkindPartition:master Nov 5, 2024
14 checks passed
@Bodigrim
Copy link
Collaborator

Bodigrim commented Nov 5, 2024

Thanks!

@jorisdral jorisdral deleted the jdral/show-qc-tests-shrinks branch November 6, 2024 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants