目录
代码示例
# -*- coding: utf-8 -*-
# @Time : 2021/10/10
# @Author : 大海
import pytest
@pytest.fixture(autouse=True)
def start():
print("登录")
yield
print("执行teardown!")
print("登出")
def test_1():
print("业务流程1")
def test_2():
print("业务流程2")
def test_3():
print("业务流程3")
if __name__ == "__main__":
pytest.main(["-s", "test_11.py"])
本文档介绍了使用Pytest框架进行测试的实践,包括fixture的使用和示例,以及如何组织测试用例如业务流程1、2、3。通过 pytest.main 调用,展示了如何运行测试脚本。
430

被折叠的 条评论
为什么被折叠?



