
pytest
文章平均质量分 94
IT界的测试混子
保持学习,学会学习
展开
-
pytest框架(2)fixture、conftest、hook、pytest.ini、allure
Fixturepytest fixture 官网:https://docs.pytest.org/en/stable/fixture.html#fixtureFixture是在测试函数运行前后,由pytest执行的外壳函数,代码可以定制,满足多变的测试需求,功能包括:定义传入测试中的数据集配置测试前系统的初始状态为批量测试提供数据源等pytest fixture 使用方法1(推荐)直接通过函数名,传递到方法中(如果需要返回值,必须使用这种方式)方法2、使用 @pytest.m原创 2021-05-01 19:47:08 · 963 阅读 · 1 评论 -
pytest框架(1)
安装pip install -U pytest测试例子# content of test_sample.pydef func(x): return x + 1def test_answer(): assert func(3) == 5执行结果$ pytest=========================== test session starts ============================platform linux -- Python 3.x.y原创 2021-04-19 10:02:31 · 166 阅读 · 0 评论