03 2022 档案

摘要:pytest-rerunfailures pytest-rerunfailures是属于pytest的插件,通常用来执行用例失败后重新执行。 安装:pip install pytest-rerunfailures 如果运行报错, 则使用python编辑器重新安装 1. 通过装饰器使用:@pytest 阅读全文
posted @ 2022-03-31 17:28 博无止境 阅读(164) 评论(0) 推荐(0) 编辑
摘要:# 定义列表 list1 = ["11", 5, 17, 18, 23] # 将列表的值转成int list1 = list(map(int, list1)) # 将列表内的值相加 print("列表元素之和为: ", sum(list1)) >>>列表元素之和为: 74 阅读全文
posted @ 2022-03-28 11:02 博无止境 阅读(350) 评论(0) 推荐(0) 编辑
摘要:方法一:通过关键字替换 # str.replace('旧字符串' , '新字符串' , '替换最大次数(可省略)') temp_str = '你好吗? 我很好' # 将所有i替换成aa print(temp_str.replace('好', '坏')) # 将i替换成aa,只替换一次 print(t 阅读全文
posted @ 2022-03-25 15:09 博无止境 阅读(28139) 评论(0) 推荐(0) 编辑
摘要:# type()的使用方法 a = "123" print(type(a)) >>><class 'str'> # isinstance()的使用方法: a = "123" print(isinstance(a, int)) print(isinstance(a, str)) >>> False T 阅读全文
posted @ 2022-03-21 15:15 博无止境 阅读(76) 评论(0) 推荐(0) 编辑
摘要:1. 打开网络设置 2. 进入网络和共享中心 2. 进入以太网 4. 查看里面的信息, 待会修改为静态ip时需要用到 然后进入cmd输入ipconfig查看是否修改成功,打开百度查看是否能入网 阅读全文
posted @ 2022-03-18 10:19 博无止境 阅读(1109) 评论(0) 推荐(0) 编辑
摘要:去掉字符串中不想要的逗号,括号等 n = '[123,456,789]' n = n.replace(',', '') # 去掉逗号 n = n.replace('[', '') # 去掉左括号 n = n.replace(']', '') # 去掉有括号 print(n)>>>123456789 阅读全文
posted @ 2022-03-17 19:13 博无止境 阅读(2844) 评论(0) 推荐(0) 编辑
摘要:需要用到(循环控制器)和(__counter)函数助手 阅读全文
posted @ 2022-03-16 19:42 博无止境 阅读(694) 评论(0) 推荐(0) 编辑
摘要:问题1:做接口测试,常常需要将上一个接口的值传入到下一个接口中,这里使用了jsonPath语法来解决; 问题2:发送请求前,常常需要传入很多变量,这里变量不一定是上一个接口的响应,有可能是时间、计算后的数据等。这里使用替换字符串来解决。 问题3:接口发送是,涉及到很多JSON格式问题,以下也是使用函 阅读全文
posted @ 2022-03-10 15:19 博无止境 阅读(545) 评论(0) 推荐(0) 编辑
摘要:1. “isdigit” 函数,判断字符串中是否全部为“数字”。 如果字符串中有一个不是数字, 则为False strs = "123" if strs.isdigit(): print("是数字") else: print("不是数字") 运行结果: >>>是数字 2. 判断字符串中是否包含“数字 阅读全文
posted @ 2022-03-09 18:29 博无止境 阅读(10878) 评论(0) 推荐(0) 编辑
摘要:# 将元组中的None值去掉,并转换为list input_= [('接口自动化测试用例', None, None, None, None, None, None)] output = [] for each in input_: newList = list(filter(None,each)) 阅读全文
posted @ 2022-03-09 17:40 博无止境 阅读(405) 评论(0) 推荐(0) 编辑
摘要:1. 启动手机模式浏览器, 手机型号只能选以下范围。 from selenium.webdriver.chrome.options import Options# 手机模式 # 设置手机型号,这设置为iPhone 6 mobile_emulation = {"deviceName": "iPhone 阅读全文
posted @ 2022-03-09 11:42 博无止境 阅读(2102) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示