上一页 1 ··· 32 33 34 35 36 37 38 39 40 ··· 80 下一页
摘要: import pytest import requests from utils.read_yaml import get_yaml_data # 多个参数(’class1,class2‘,[('age','eat'),('age','eat')]) @pytest.mark.parametrize 阅读全文
posted @ 2023-08-02 21:16 胖豆芽 阅读(177) 评论(0) 推荐(0)
摘要: import pytest # 多个参数(’class1,class2‘,[('age','eat'),('age','eat')]) @pytest.mark.parametrize('dog,cat',[('2','bone'),('1','fish')]) def test_params(do 阅读全文
posted @ 2023-08-02 20:45 胖豆芽 阅读(29) 评论(0) 推荐(0)
摘要: 上图示例 def setup_module(): print('准备测试数据') def teardown_module(): print('清理测试数据') def test_one(): ex=1 real=1 assert ex==real 仅在模块中执行一次 阅读全文
posted @ 2023-08-02 18:09 胖豆芽 阅读(39) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2023-08-02 18:06 胖豆芽 阅读(21) 评论(0) 推荐(0)
摘要: import requests HOST = 'https://ip.com' URL = '/posts/' url=HOST+URL jsons={# 尽量不要使用json作为变量 防止和json关键字冲突 "title": "foo", "body":" bar", "userId": 1 } 阅读全文
posted @ 2023-08-02 13:18 胖豆芽 阅读(37) 评论(2) 推荐(0)
摘要: class BaseAPI: # 基类 相当于动物类 ; 登录 属于继承类,相当于老虎类 # 属性 def __init__(self,token=None): # 店铺类,订单类,支付模块等都需要使用token 所以过滤一下 if token:# 如果接口需要token 店铺类,订单类,支付模块等 阅读全文
posted @ 2023-08-02 12:13 胖豆芽 阅读(23) 评论(0) 推荐(0)
摘要: import requests from http.client import HTTPConnection HTTPConnection.debuglevel=1 import requests # 请求url url = "http://ip:port/file" # 请求头 headers = 阅读全文
posted @ 2023-08-01 20:15 胖豆芽 阅读(507) 评论(0) 推荐(0)
摘要: json.loads()函数只能将一个合法的JSON字符串转换为相应的Python对象(例如字典、列表等)。它无法处理包含多个JSON字符串的字符串 第一种str='{"code": 9999, "data": "", "flag": "11", "msg": "该用户不存在!", "success 阅读全文
posted @ 2023-07-30 18:33 胖豆芽 阅读(1109) 评论(2) 推荐(0)
摘要: # py 文件必须test开头 # 测试类必须Test开头 import ast import pytest from utils.handle_yaml import get_yaml from utils.handle_xls_my import get_excel_data import js 阅读全文
posted @ 2023-07-30 15:18 胖豆芽 阅读(30) 评论(0) 推荐(0)
摘要: # 导包import xlrddef get_excel_data(file_path,sheet_name,case_name,*args): # 定义一个列表 存[(第下标1行里 test列里的值,test1列里的值),(第下标1行里 test列里的值,test1列里的值)] xls_data 阅读全文
posted @ 2023-07-28 14:10 胖豆芽 阅读(17) 评论(0) 推荐(0)
上一页 1 ··· 32 33 34 35 36 37 38 39 40 ··· 80 下一页