pytest
LiaoBin0608
这个作者很懒,什么都没留下…
展开
-
pytest学习笔记4
1、allure安装 安装pytest pip install pytest 安装allure-pytest pip install allure-pytest 2、下载allure命令行工具 1、去github上下载最新版https://github.com/allure-framework/allure2/releases 2、下载完成后,解压本地,并匹配环境变量(最好放在path的第一位) 3、allure执行与生成报告 执行命令 pytest [py文件] -q -s --al原创 2020-06-11 15:12:43 · 147 阅读 · 0 评论 -
pytest学习笔记3
1、函数传参数 当前置用例函数需要传参 import pytest test_login_data = [("admin","admin"),("user","123456")] def login(user, pwd): print(f"登录用户名:{user}") print(f"登录密码:{pwd}") if pwd == "admin": return True else: return False @pytest原创 2020-06-11 00:02:23 · 176 阅读 · 0 评论 -
pytest学习笔记2
1、pycharm设置pytest 1、选择File-setting,搜索框中搜索pytest, 2、可以看到Tools-Python IntegratedTools,有个Testing选项下Default test runner,选择pytest,点击Apply,点击OK 2、pycharm运行pytest 1、直接右击空白处,点击‘Run ‘pytest in *’’ 2、运行单个类或者方法,点击左侧的绿色三角箭头 3、pytest fixture的用法 fixture 用法 Fixtu原创 2020-06-10 17:58:19 · 323 阅读 · 0 评论 -
pytest学习笔记1
1、安装pytest pip install -U pytest 2、查看pytest版本 pytest --version 或 pytest -V 3、pytest用例设计原则 1、测试文件以test开头(或者以_test结尾) 2、测试类以Test开头,并且不能带init方法 3、测试函数以test_开头 def add(x, y): return x + y def test_add(): assert add(1, 10) == 11 assert add(1,原创 2020-06-10 18:02:48 · 164 阅读 · 0 评论