[TIP] Randomizing test order with nose

Douglas Philips dgou at mac.com
Wed Apr 22 10:03:51 PDT 2009

On 2009 Apr 22, at 12:51 PM, Scott David Daniels indited:
> Be careful here.  For randomized tests in any form (including  
> execution
> order), it is vital to be able to rerun _exactly_the_same_test(s)_.   
> So, provide a
> command line arg (or whatever) that allows you to seed the random  
> number generator,
> and always provide the seed used when running a randomized system.

We've found that it is crucial to be able to reproduce test runs.
Even more crucial is to be able to pluck out a failing test and rerun  
it with the exact same random-number-environment.
Our solution is:
     provide a command line argument (to support "reproducing results")
     have the framework itself print out the seed used for each run  
(to maximize the shuffling and still allow reproducible results)
     have the framework itself reset the seed to the known value  
before each test (to enable re-running of just one test)

I'm curious to know if there is a simpler way to achieve those three  


More information about the testing-in-python mailing list