![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
pytest框架
文章平均质量分 64
yaaaxia
这个作者很懒,什么都没留下…
展开
-
如何搭建接口自动化测试框架?
在工作中,当一个项目确定要做接口自动化测试之后,我们一般面临两种情况:1.公司已经在做自动化测试,自己成为其中的一员这种情况下,我们需要做的就是快速了解现成的自动化测试框架,多看项目代码,了解团队的业务逻辑、代码风格,快速融入进去。2.公司之前没有在做,需要你0-1搭建。这时候就需要我们去根据项目和自身技能的具体情况,去规划整个自动化测试框架。一、自动化测试框架规划思路1.选择语言pythonjava自己擅长哪个选哪个,推荐python2.编程工具选型pycharmvscode自己转载 2022-03-07 18:11:26 · 4531 阅读 · 3 评论 -
pytest框架--参数化(parametrize装饰器)
说明:软件测试中,输入相应值,检查期望值,是常见测试方法。在自动化测试中,一个测试用例对应一个测试点,通常一组测试数据无法完全覆盖测试范围,所以,需要参数化来传递多组数据。pytest的测试用例参数化使用如下装饰器即可完成。参数化:parametrize装饰器@pytest.mark.parametrize(argnames, argvalues)argnames:以逗号分隔的字符串argvalues: 参数值列表,若有多个参数,一组参数以元组形式存在,包含多组参数的所有参数,以元组列表形式存原创 2022-02-23 15:40:49 · 965 阅读 · 0 评论 -
pytest框架--前后置(setup/teardown+fixture装饰器)
pytest前后置处理有2种方法1、通过setup/teardown实现import pytestclass Test_C(): def setup(self): # 方法前置 print('\n-----函数开始-----', end='') def teardown(self): # 方法后置 print('\n-----函数结束-----', end='') def setup_class(self):原创 2022-02-18 15:46:59 · 615 阅读 · 0 评论 -
pytest框架--allure报告用例参数详解
原文链接:http://www.manongjc.com/detail/18-uxknglitylthfjx.html1、案例描述:#test_allure_demo.pyimport pytestimport allure@pytest.fixture(scope="session")def login(): print("前置条件:登录")@allure.step("步骤1")def step_1(): print("操作步骤----1")@allure.step(原创 2021-12-07 18:09:10 · 868 阅读 · 0 评论 -
pytest基础知识
1、安装pytestpip install -U pytest # 通过pip安装2、运行方法创建一个简单的实例,如下def test_one(): print("我的方法1") x = "this" assert "h" in xdef test_two(): print("我是方法2") y = 5 assert y > 6切换至该文件所在的目录,输入命令:py.test test1.py (test1.py 为文件名)原创 2021-12-06 16:30:13 · 779 阅读 · 0 评论