1.分层处理 POM
POM的核心思想:把重复的操作独立出去
2.报表
生成allure报表的固定写法
3.pytest测试
4.其他
4.1元组解包使用*
4.2使用yaml文件作为数据驱动
安装PYyaml包: pip install PYyaml
导入yaml使用;import yaml
4.2.1读取yaml文件内容 ,,如图
with open('./lab1.yaml','r') as f:
yaml_template = yaml.safe_load(f)
写入yaml文件
yaml_dict = { "user": "general", "country": "China", "gender": "male", "address": "北京" } yaml_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'a.yml') with open(yaml_dir, 'w', encoding='utf-8', ) as f: yaml.dump(yaml_dict, f)
========================= 更新中 =================================
标签:__,4.2,open,学习,yaml,测试,自动化,path,os From: https://www.cnblogs.com/hqsbrx/p/17934902.html