0

Here is my code:

class MyTestCase(Base):
    def setUp(self):
        #some code here

    def test_B(self):
        #some code here

    def test_C(self):
        #some code here

    def test_A(self):
        #some code here

    def tearDown(self):
        #some code here

if __name__ == "__main__":
    unittest.main()

My problem here is that all my tests are executed in alphabetical order, i.e. test_A is first executed, then test_B and then test_C. I want it to execute in the order I have written, i.e. test_B -> test_C -> test_A.

How do I change the order in which the tests are executed?

Chris Morgan
  • 86,207
  • 24
  • 208
  • 215
jacksparrow007
  • 1,298
  • 4
  • 19
  • 30

1 Answers1

3

If your tests need to be in a specific order I think they should be in the same function, but thats just my opinion, check out changing order of unit tests in Python

Community
  • 1
  • 1
Samy Vilar
  • 10,800
  • 2
  • 39
  • 34