2021年7月20日
摘要: format()格式化输出 format():把传统的%替换为{}来实现格式化输出 #允许一个参数用两次'{1}{0}{1}岁'.format('jc',22) #按位置【1、0、1】取值>>>'22jc22岁'#可以通过添加关键字参数'{name}{age}岁'.format(age=22,nam 阅读全文
posted @ 2021-07-20 19:23 悟奕 阅读(563) 评论(0) 推荐(0) 编辑
  2021年7月19日
摘要: 1、driver.switch_to.frame() 一般情况下,我们可以直接通过id或者name切换到frame。 driver.switch_to.frame()小括号里面填iframe标签的id,或name值如果没有id,或者name,我们可以先定位到iframe标签,再切换到frame# 根 阅读全文
posted @ 2021-07-19 19:09 悟奕 阅读(189) 评论(0) 推荐(0) 编辑
  2021年7月18日
摘要: # pandas默认依赖xlrd库,故先安装xlrdpip install xlrd# 安装Pandaspip install PandasPandas 语法 复制代码import Pandas as pd# 首先初始化,engine默认是xlrds = pd.ExcelFile(path_or_b 阅读全文
posted @ 2021-07-18 17:55 悟奕 阅读(242) 评论(0) 推荐(0) 编辑
摘要: def read_data_from_excel(excel_file,sheet_name): return_value=[] #判断文件是否存在 if not os.path.exists(excel_file): raise ValueError("File not exists") #打开指 阅读全文
posted @ 2021-07-18 17:23 悟奕 阅读(245) 评论(0) 推荐(0) 编辑
摘要: pytest.fixtures 的语法如下: fixture(scope="function", params=None, autouse=False, ids=None, name=None)其中,fixture 的 5 个参数如下。 scope:用于控制 fixture 的作用范 这个参数有以下 阅读全文
posted @ 2021-07-18 16:28 悟奕 阅读(76) 评论(0) 推荐(0) 编辑
摘要: 使用 conftest.py 来共享 fixture 通过上面的学习,我们掌握了如何在同一个文件中进行 fixture 的定义、共享和使用。但在日常工作测试中,我们常常需要在全局范围内使用同一个测试前置操作。例如,测试开始时首先进行登录操作,接着连接数据库。 这种情况下,我们就需要使用 confte 阅读全文
posted @ 2021-07-18 16:27 悟奕 阅读(46) 评论(0) 推荐(0) 编辑
  2021年7月16日
摘要: https://pypi.org/project/pytest/ 打开cmd 到达安装目录 python setup.py build python setup.py install python安装路径,可以在环境变量查看H:\Users\wuxiaojian.wb\AppData\Local\P 阅读全文
posted @ 2021-07-16 14:17 悟奕 阅读(17) 评论(0) 推荐(0) 编辑
摘要: #运行用例生成报告import unittest,osfrom common.html_reporter import GenerateReport if __name__ == "__main__": suite = unittest.defaultTestLoader.discover(os.p 阅读全文
posted @ 2021-07-16 14:16 悟奕 阅读(29) 评论(0) 推荐(0) 编辑