
pytest
文章平均质量分 82
weixin_46583017
这个作者很懒,什么都没留下…
展开
-
pytest-fixture
pytest-fixture 一、适用范围 1.替代setup和teardown 2.参数化 如何使用: 1.给要使用的方法传入fixture的函数名 2.使用装饰器@pytest.mark.usefixtures(’’) 3.可以使用多个fixture 4.作用域:session>module>class>function 二、替代setup和teardown 替代setup 给要使用的方法传入fixture的函数名 使用装饰器@pytest.mark.usefixtures(’’) i原创 2021-01-02 16:39:18 · 336 阅读 · 2 评论 -
allure安装和使用(feature,链接,图片,html)
allure安装和使用一、allure安装二、allure使用生成报告1.pytest -sq ***.py --alluredir=./result/12.pytest serve ./result/1生成一次性报告3.pytest generate ./result/1 -o ./report/1生成并保存报告4.allure open -h 192.168.1.104 -p 3772 ./report/12.常用特性2.1添加功能信息,子功能信息,测试步骤加--allure-feature或者--al原创 2021-01-02 14:47:10 · 1635 阅读 · 1 评论 -
yaml+pytesth中parametrize参数化如何引入参数
yaml+pytesth中parametrize参数化yaml数据文件待测试代码块yaml+pytesth中parametrize测试方法一:打开yaml文件和测试代码写在一起方法二:把打开yaml文件单独写在一个py中1.ya_try.py2.读入数据 yaml数据文件 testdata.yaml add: [0,1,1] [-1,0,-1] [-1,1,0] [-9.4536,-9.55,-19.0036] addids: Positive negative int decimal sub: [-1,原创 2020-12-30 11:15:19 · 1596 阅读 · 0 评论 -
pytest-----setup和teardown的作用域
pytest-----setup和teardown的作用域setup和teardown的作用域代码结果优先级 setup和teardown的作用域 代码 #本段代码目的是说清楚setup和teardown的作用域 def test_case1(): print("这是一个函数测试用例1") def test_case2(): print("这是一个函数测试用例2") #setup_function和teardown_function def setup_function(self):原创 2020-12-29 11:48:17 · 461 阅读 · 0 评论