-
Notifications
You must be signed in to change notification settings - Fork 22
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
Seed parameter to reproduce a failed test #80
Comments
Hi @lake-effect. Good question. Rantly uses Kernel#rand to generate random data so you should be able to use Kernel#srand to seed random number generation from a numeric seed value. This example will generate the same string require 'rantly'
Kernel.srand(123)
puts Rantly { string }
# => b|1sYv Looking at rspec docs (Randomization can be reproduced across test runs) it seems you could map the rspec seed value to Can you try the following in your rspec setup before test execution? srand RSpec.configuration.seed That should make your rspec and rand seed match which should give you reproducible randomization in rantly. |
I made the following change to RSpec.configure do |config|
+ srand RSpec.configuration.seed Ran Assuming that's correct, maybe the seed Rantly was using at the time was something else and I can't reproduce it yet? |
I noticed that the seed gets you different results if you're running on a specific test |
Say you have a lot of data as your test input. When you get a failure message, rantly/rantly-rspec ends up telling you so much that you can't use it for reproducing regressions:
It turns out that running
rspec --seed 61833
doesn't reproduce this input set either.Is there a shorthand way to tell rspec + rantly to run this exact test again?
The text was updated successfully, but these errors were encountered: