-
Notifications
You must be signed in to change notification settings - Fork 51
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
Can't consistently set number of examples #48
Comments
Thanks for the report, could you create a minimal project that reproduces the issue? The number of examples used might vary if the generator finds a large number of duplicate, but I can't think of a scenario where it should generate more than the specified number of examples, only less. |
I've figured out when this is happening for me, and when it isn't. Setting the number of examples works for most test cases. The test I've found where it doesn't work is a test that makes HTTP requests. Here's some "code" that resembles my test that isn't working properly:
If I comment out the Does this help? Any ideas why this would be happening? |
Sorry for the slow response btw, just got back from vacation and have been busy with some other stuff 😅 |
@hcoles Have you gotten a chance to look at this? |
Hi I am experiencing the same issue. Both with withTestingTime and withExamples combined with testing api responses.
A fix for this is much appreciated! |
@reedrosenbluth @hcoles @ProofOfPizza I spent some time debugging this with a test codebase today. It is not related to HTTP errors but when any kind of unchecked exception is thrown inside So if the original setting for examples in the test is say 20 and on the 19th attempt the test throws a To fix this, just set the shrink cycles manually:
Hope this helps! |
I can't seem to set the number of examples in a test I'm writing. I have two almost identical tests, the only difference is the generator, which is also nearly identical, and the assertions in
checkAssert
. Setting the number of examples using eitherqt().withExamples(25)
orSystem.setProperty("QT_EXAMPLES", "25")
works in the first test, but does not seem to work in the second test, as adding a print statement indicates the test runs more than the set number of times. One edge case I've discovered is that if I set the number of examples to1
it does in fact limit it to1
, but any other number seems to have no effect for this test.Any idea how to fix this? Thanks.
The text was updated successfully, but these errors were encountered: