• 解决:
• 安装:pip install pytest-ordering
• 在测试方法上加下面装饰器
•@pytest.mark.last ---最后一个执行
• @pytest.mark.run(order=1)---第几个执行
pytest默认按字母顺序去执行的
import pytest
@pytest.mark.run(order=1)
def test_01():
print('test01')
@pytest.mark.run(order=2)
def test_02():
print('test01')
@pytest.mark.last
def test_06():
print('test01')
def test_04():
print('test01')
def test_05():
print('test01')
@pytest.mark.run(order=3)
def test_03():
print('test01')
pytest_order.py::test_01 PASSED [ 16%]test01
pytest_order.py::test_02 PASSED [ 33%]test01
pytest_order.py::test_03 PASSED [ 50%]test01
pytest_order.py::test_04 PASSED [ 66%]test01
pytest_order.py::test_05 PASSED [ 83%]test01
pytest_order.py::test_06 PASSED [100%]test01
原文地址:https://www.cnblogs.com/QaStudy/p/11567039.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。