摘要: 如果要在报告中加入每一个测试用例执行的logging信息,则需要改HTMLTestRunner的源码 1、初始化定义logging信息, class _TestResult(TestResult): # note: _TestResult is a pure representation of re 阅读全文
posted @ 2022-03-08 15:50 究极不吃香菜 阅读(109) 评论(0) 推荐(0)
摘要: #!/usr/bin/python3 # -*- coding: utf-8 -*- #coding=utf-8 import os """ A TestRunner for use with the Python unit testing framework. It generates a HTM 阅读全文
posted @ 2022-03-08 12:22 究极不吃香菜 阅读(185) 评论(0) 推荐(0)
摘要: python 生成日志文件及写入 def log_ging(): level = logging.DEBUG filename = 'test_log_' log_path = os.path.dirname(os.getcwd()) + '/baidu/baidu_logs/'#父目录路径 dat 阅读全文
posted @ 2022-03-07 18:28 究极不吃香菜 阅读(74) 评论(0) 推荐(0)
摘要: 1、Unittest 是python内置的标准类库,它的API跟java的Junit、.net的NUnit、C++的CppUnit很相似,通过继承unittest.TestCase来创建一个测试用例。 2、 Doctest Doctest模块会搜索那些看起来像交互式会话的python代码片段,然后尝 阅读全文
posted @ 2022-03-03 16:38 究极不吃香菜 阅读(659) 评论(0) 推荐(0)
摘要: ##测试数据 表格数据转化为字典提供测试脚本使用, import sys,os from openpyxl import load_workbook add_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys. 阅读全文
posted @ 2022-03-02 17:46 究极不吃香菜 阅读(182) 评论(0) 推荐(0)
摘要: 读取打开文件 with open(text_pat, 'r', encoding='utf-8') as r_f: #text_pat:文件路径 #'r' :打开方式/读写 OR 其他 #encoding: 编码格式 array = r_f.readlines()#读取多行文件,以列表的形式展示,如 阅读全文
posted @ 2022-03-02 11:25 究极不吃香菜 阅读(70) 评论(0) 推荐(0)
摘要: 读取指定yaml文件数据 import yaml import sys,os add_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.append(add_path) path = os.path 阅读全文
posted @ 2022-03-01 18:12 究极不吃香菜 阅读(110) 评论(0) 推荐(0)
摘要: 获取当前文件父级路径 path = os.path.dirname(__file__) 添加当前文件至环境变量 import sys,os add_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path. 阅读全文
posted @ 2022-02-28 18:19 究极不吃香菜 阅读(248) 评论(0) 推荐(0)
摘要: 浏览器相关 #coding=utf-8 from selenium.webdriver import Chrome from selenium import webdriver driver = webdriver.Firefox() # driver = webdriver.Chrome driv 阅读全文
posted @ 2022-02-28 17:53 究极不吃香菜 阅读(141) 评论(0) 推荐(0)
摘要: from selenium import webdriver chrome_options = webdriver.ChromeOptions() chrome_options.add_argument('disable-infobars') chrome_options.add_argument( 阅读全文
posted @ 2022-02-24 14:42 究极不吃香菜 阅读(1039) 评论(0) 推荐(0)