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
  • 79,487
  • 22
  • 198
  • 207
jacksparrow007
  • 1,228
  • 4
  • 18
  • 29

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,109
  • 2
  • 34
  • 33