简体   繁体   中英

Controlling the order tests are run in Selenium

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, ie test_A is first executed, then test_B and then test_C. I want it to execute in the order I have written, ie test_B -> test_C -> test_A.

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

如果您的测试需要按照特定的顺序进行,我认为它们应该具有相同的功能,但这仅是我的看法,请查看Python中单元测试的更改顺序

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM