这是我的代码:
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()
我的问题是我所有的测试都是按字母顺序执行的,即首先执行 test_A,然后是 test_B,然后是 test_C。我希望它按照我写的顺序执行,即 test_B -> test_C -> test_A。
如何更改测试的执行顺序?
最佳答案
如果您的测试需要按特定顺序进行,我认为它们应该在同一个函数中,但这只是我的意见,请查看 changing order of unit tests in Python
关于python - 控制顺序测试在 Selenium 中运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11094457/