[TIP] Randomizing test order with nose

Charles McCreary charles.mccreary at crmeng.com
Wed Apr 22 08:32:13 PDT 2009


About two years ago, Titus had a "random idea" in which he proposed a nose
plugin that would randomize the test order. In one of the projects I'm
involved in, that has turned out to be rather important. I can do this
within the unittest framework with:

class TestXMLHTTPResponder(unittest.TestCase):

... tests...

if __name__ == "__main__":

    import random
    suite =
unittest.TestLoader().loadTestsFromTestCase(TestXMLHTTPResponder)
    random.shuffle(suite._tests)
    unittest.TextTestRunner(verbosity=2).run(suite)

But I use nose, so a plugin that would randomize the order would be helpful.
Before I charge off and write one, has anyone already done it?

*Charles R. McCreary P.E.*
13774 Hwy 322
Kilgore, TX 75662
Voice: 903.643.3490
Fax: 866.804.1919
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.idyll.org/pipermail/testing-in-python/attachments/20090422/dea82dc9/attachment.htm 


More information about the testing-in-python mailing list