python - 控制顺序测试在 Selenium 中运行

标签 python testing selenium

这是我的代码:

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/

相关文章:

kotlin - 如何将 Kotlin 测试输出打印到控制台而不是 html 报告?

Python Selenium Phantomjs,在运行时设置代理

testing - Jmeter SQL 测试

python - 如何使用线程进行客户端服务器应用程序的功能测试?

python - 使用 Selenium 获取 HTML 的某些元素

scala - uber jar 中的 NoSuchMethodError 异常

java - 更新 pom xml 时 - PKIX 路径构建失败 : sun. security.provider.certpath.SunCertPathBuilderException

python - 导入 pytorch 模块时出错。 (指定的模块无法找到。)

python - 如何使用wxpython获得禁用按钮的点击?

python - 从 GAE 开发服务器中拒绝访问模块