dimanche 6 novembre 2016

define order of tests with unittest

I have a set of tests, but some of them use as input, the output of some previous tests. Here is how I do define my suite tests:

listOfTests = []
listOfTests+= unittest.TestLoader().loadTestsFromTestCase(TTestA)
listOfTests+= unittest.TestLoader().loadTestsFromTestCase(TTestB)
listOfTests+= unittest.TestLoader().loadTestsFromTestCase(TTestC)

unittest.main(testRunner=xmlrunner.XMLTestRunner(output=os.getcwd() + '/xmlTests')).suite(listOfTests)

How Can I ensure that the tests are executed in the order sequence I define them? Is there some option which needs to be set for unittest such that TTestA is ran after TTestA. Thanks for your valuable help.

Aucun commentaire:

Enregistrer un commentaire