随笔分类 -  Python

摘要:第一步:pip install pytest-allure-adaptor 第二步:编写用例 #执行后自动打开报告 allure serve allure 执行一下命令 生成xml数据 阅读全文
posted @ 2019-09-17 15:19 mahaining 阅读(987) 评论(0) 推荐(0)
摘要:全功能Python测试框架:pytest python通用测试框架大多数人用的是unittest+HTMLTestRunner,这段时间看到了pytest文档,发现这个框架和丰富的plugins很好用,所以来学习下pytest. image.png image.png pytest是一个非常成熟的全 阅读全文
posted @ 2019-09-17 10:01 mahaining 阅读(229) 评论(0) 推荐(0)
摘要:在使用pip install mysqlclient 报错 然后有使用下再下来的whl包安装 pip install mysqlclient-1.4.2-cp36-cp36m-win_amd64.whl 结果还是报错 最终解决方案 原因是python pip 有两个版本共存的问题 解决方案: 解决方 阅读全文
posted @ 2019-06-21 19:56 mahaining 阅读(3241) 评论(0) 推荐(0)
摘要:import glob # path_file_number=glob.glob('D:/case/test/testcase/checkdata/*.py')#或者指定文件下个数 path_file_number=glob.glob(pathname='*.py') #获取当前文件夹下个数 print(path_file_number) print(len(path_file_number))... 阅读全文
posted @ 2019-01-11 20:51 mahaining 阅读(26864) 评论(0) 推荐(1)
摘要:reportPath =文件夹路径 listdir=以一个list返回文件夹下所以文件 dirs = os.listdir(reportPath)print(dirs) def __get_report(self): """获取最新测试报告""" dirs = os.listdir(reportPa 阅读全文
posted @ 2018-11-04 02:03 mahaining 阅读(824) 评论(0) 推荐(0)
摘要:安装yaml:pip install pyyaml写入yaml: import json from ruamel import yaml aproject ={'cardBalance': 18850} aproject2 ={"cardNumber": "22222222"} # # print(aproject) # # def th(cas): # # f = open(r't... 阅读全文
posted @ 2018-10-08 17:04 mahaining 阅读(2792) 评论(0) 推荐(0)
摘要:由于这些天做接口测试所以把以前的东西复习一下,以下是我日志的配置logging 模块介绍setLevel:设置输入的日志级别Formatter :设置输入日志格式FileHandler:将日志信息输出到文件上StreamHandler:指定输入到控制台函数addHandler:日志添加logging中 DEBUG 是记录所有状态的错误信息的,特别注意WARNING 只记录错误以上的信息logg... 阅读全文
posted @ 2018-09-24 22:51 mahaining 阅读(179) 评论(0) 推荐(0)
摘要:第一中大小写加数字的字符串 阅读全文
posted @ 2018-09-13 14:36 mahaining 阅读(2446) 评论(0) 推荐(0)
摘要:# 添加字典# d = {## 95: 'Adam',## 85: 'Lisa',## 59: 'Bart'## }# # d[55]='jack'# print (d[95])# 获取key 合值# d = {# 'Adam': 95,# 'Lisa': 85,# 'Bart': 59# }# f 阅读全文
posted @ 2018-08-06 23:27 mahaining 阅读(224) 评论(0) 推荐(0)
摘要:# coding:utf-8 """ Compatible for python2.x and python3.x requirement: pip install requests """ import requests # 请求示例 url 默认请求参数已经做URL编码 from httprunner import response import unittest class Case(un... 阅读全文
posted @ 2018-08-06 23:25 mahaining 阅读(311) 评论(0) 推荐(0)
摘要:常规列表去重的两种方法 第一种: list=[1,2,2,2,2,3,4,5,5,6,7,8,8,9] list2=[] for a in list: if a not in list2: list2.append(a) print (list2) 第二种: list=[1,2,2,2,2,3,4, 阅读全文
posted @ 2018-08-06 23:19 mahaining 阅读(152) 评论(0) 推荐(0)