Search code examples
rubyminitest

Get the Minitest seed value programmatically


In RSpec I would use the following to obtain a Random which is seeded from the test order random seed. This would give us a reproducible RNG for things like fuzzing:

reproducible_random = Random.new(RSpec.configuration.seed)

Now that I am working with a project that uses Minitest (the Rails default) I can't seem to find how to obtain the Minitest seed value and produce a reproducible test. Is there a way to access it someplace from inside the tests themselves?


Solution

  • As of Minitest 5.16.0, the seed is available via Minitest.seed