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 ability to specify number of tests to the quickcheck macro #85

Closed
Wilfred opened this issue Jul 24, 2015 · 6 comments
Closed

Add ability to specify number of tests to the quickcheck macro #85

Wilfred opened this issue Jul 24, 2015 · 6 comments

Comments

@Wilfred
Copy link

Wilfred commented Jul 24, 2015

I have a quickcheck test using Vec<EnumWithManyVariants> and my tests rarely fail. It would be nice if I could set an environment variable to make quickcheck try more possible inputs.

@BurntSushi
Copy link
Owner

@Wilfred To clarify, have you seen the tests method? http://burntsushi.net/rustdoc/quickcheck/struct.QuickCheck.html#method.tests Or are you specifically asking for this to be settable via an environment variable?

@astahfrom
Copy link

It would be nice to be able to control this when using the #[quickcheck] attribute also.

@Wilfred
Copy link
Author

Wilfred commented Jul 28, 2015

I think my use case is probably the same as Andreas: I have a load of tests using the #[quickcheck] attribute and I can't change the number of tests run. It would probably make more sense if it could be controlled per-test, so I could increase the number for tests which I've observed to find failures occasionally.

@BurntSushi BurntSushi changed the title Add ability to specify number of tests Add ability to specify number of tests to the quickcheck macro Jul 28, 2015
@remexre
Copy link
Contributor

remexre commented May 30, 2017

I think this is already implemented: https://github.com/remexre/quickcheck/blame/master/src/tester.rs#L20

Close as fixed?

@Wilfred
Copy link
Author

Wilfred commented May 30, 2017

That's certainly helpful, because users can explicitly re-run a single test and set QUICKCHECK_TESTS to explore more test cases if they wish.

However, it doesn't meet the following usecases:

  • If I have a test that runs slowly, I might want to lower the number of test cases attempted
  • If I have a fast test and a large test case space (so my tests occasionally fail when doing TDD), I might want to increase the number of test cases attempted

In both of these cases, I want to change the number of test cases per test, and make a permanent change.

That's my usecase at least. If you think the current functionality is sufficient for quickcheck's goals, I understand.

@remexre
Copy link
Contributor

remexre commented May 30, 2017

It'd be "probably not too hard" to change the quickcheck! macro to allow a per-test #[quickcheck_tests = 1234] attribute as well; if you want to try that, feel free, otherwise I might play around with it if I have a free weekend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants