首页 > 解决方案 > 如何在 selenium python 中更改集成测试的优先级

问题描述

我的测试用例示例

from django.contrib.staticfiles.testing import StaticLiveServerTestCase
...

class CustomerTest(StaticLiveServerTestCase):
    @classmethod
    def setUpClass(cls):
        super(CustomerTest, cls).setUpClass()
        ...

    @classmethod
    def tearDownClass(cls):
        super(CustomerTest, cls).tearDownClass()
        ...

    def setUp(self):
        super(CustomerTest, self).setUp()
        ...

    def tearDown(self):
        super(CustomerTest, self).tearDown()
        ...

    def test_create(self):
        print("A")

    def test_search(self):
        print("B")

结果 :AB

这里发现的问题是,当我改变测试的优先级时,它不会改变结果

   def test_search(self):
       print("B")

   def test_create(self):
       print("A")

结果仍然:AB

预期结果 :BA

那么,如何在集成测试中更改测试用例的优先级

标签: pythondjangoseleniumintegration-testingdjango-testing

解决方案


推荐阅读