当前位置: 首页 > news >正文

红河县网站建设微信推广图片

红河县网站建设,微信推广图片,长沙装修公司电话号码大全,花瓣网 素材 图库一、YAML详解 YAML是一种数据类型,它能够和JSON数据相互转化,它本身也是有很多数据类型可以满足我们接口 的参数类型,扩展名可以是.yml或.yaml 作用: 1.全局配置文件 基础路径,数据库信息,账号信息&…

一、YAML详解

YAML是一种数据类型,它能够和JSON数据相互转化,它本身也是有很多数据类型可以满足我们接口 的参数类型,扩展名可以是.yml或.yaml

作用:

1.全局配置文件
基础路径,数据库信息,账号信息,日志格式,报告名称等。
2.编写测试用例
接口自动化测试用例

语法结构:

1.区分大小写 Name name
2.通过缩进来表示层级关系。使用空格。
3.可以使用#作为注释
4.字符串一般默认可以不使用引号,必须时才使用。

数据类型:

基本类型:

整数
浮点数
字符串(当有特殊字符时:双引号不会被转义,其它的都会加一个转义符\)
布尔值
null
日期时间

复杂类型:

对象(字典):键: (空格)
数组(列表):它是使用 一组横线"-" 开头。

数据类型强转:【鸡肋】

!!int
!!str

引用:

引用:&建立锚点(标记),*使用锚点,<<表示合并到当前数据。

二、YAML的读写和清空

安装:
pip install pyyaml
读写和清空
#读取 
def read_yaml(yaml_path): with open(yaml_path,encoding="utf-8",mode="r") as f: value = yaml.safe_load(f) return value #写入 
def write_yaml(yaml_path,data): with open(yaml_path,encoding="utf-8",mode="w") as f: yaml.safe_dump(data, stream=f,allow_unicode=True) # #清空 
def clear_yaml(yaml_path): with open(yaml_path, encoding="utf-8", mode="w") as f: pass

三、pytest的parametrize结合yaml实现数据驱动

@pytest.mark.parametrize("参数名","参数值(可以是list或tuple)")

方法一:【不常用】

方法二:【常用】
class TestApi:@pytest.mark.parametrize("caseinfo", read_yaml("../testcases/test_api.yaml"))def test_login2(self,caseinfo):print("登录测试用例:%s " % caseinfo)
-username: adminpassword: "001"
-username: admin2password: "002"
-username: admin3password: "003"
多个用例
-feature: 正例:接口所属模块story: 接口名称title: 用例标题request:method: geturl: http://www.baidu.comheaders: 请求头params: 请求参数validate: null-feature: 反例:接口所属模块story: 接口名称title: 用例标题request:method: geturl: http://www.baidu.comheaders: 请求头params: 请求参数validate: null


文章转载自:
http://copt.qpnb.cn
http://havildar.qpnb.cn
http://anemone.qpnb.cn
http://avdp.qpnb.cn
http://hod.qpnb.cn
http://inexpugnable.qpnb.cn
http://selachian.qpnb.cn
http://ansate.qpnb.cn
http://castaway.qpnb.cn
http://colloid.qpnb.cn
http://shensi.qpnb.cn
http://rsp.qpnb.cn
http://damnyankee.qpnb.cn
http://snowcreep.qpnb.cn
http://tyrrhenian.qpnb.cn
http://empocket.qpnb.cn
http://woodruffite.qpnb.cn
http://cultivar.qpnb.cn
http://whitsunday.qpnb.cn
http://radiotracer.qpnb.cn
http://interrogatory.qpnb.cn
http://undertone.qpnb.cn
http://sungari.qpnb.cn
http://metadata.qpnb.cn
http://dungaree.qpnb.cn
http://roadwork.qpnb.cn
http://haftarah.qpnb.cn
http://bayou.qpnb.cn
http://narc.qpnb.cn
http://meditator.qpnb.cn
http://callipers.qpnb.cn
http://pedler.qpnb.cn
http://eldritch.qpnb.cn
http://paraphernalia.qpnb.cn
http://morphonology.qpnb.cn
http://bull.qpnb.cn
http://heartburn.qpnb.cn
http://mesopause.qpnb.cn
http://catheterize.qpnb.cn
http://detestably.qpnb.cn
http://colaborer.qpnb.cn
http://oda.qpnb.cn
http://flickeringly.qpnb.cn
http://contributor.qpnb.cn
http://protectory.qpnb.cn
http://conversationist.qpnb.cn
http://lysogeny.qpnb.cn
http://poughite.qpnb.cn
http://stonecutter.qpnb.cn
http://parallelogram.qpnb.cn
http://peeblesshire.qpnb.cn
http://uriel.qpnb.cn
http://rsp.qpnb.cn
http://idle.qpnb.cn
http://glyptography.qpnb.cn
http://whodunit.qpnb.cn
http://atavic.qpnb.cn
http://catrigged.qpnb.cn
http://mottramite.qpnb.cn
http://woden.qpnb.cn
http://polygene.qpnb.cn
http://estate.qpnb.cn
http://balaam.qpnb.cn
http://marampa.qpnb.cn
http://pipeline.qpnb.cn
http://inviolateness.qpnb.cn
http://crinum.qpnb.cn
http://eiffel.qpnb.cn
http://fresno.qpnb.cn
http://elaioplast.qpnb.cn
http://algologist.qpnb.cn
http://pregnenolone.qpnb.cn
http://brakie.qpnb.cn
http://oogamete.qpnb.cn
http://dysentery.qpnb.cn
http://pretext.qpnb.cn
http://overfulfil.qpnb.cn
http://exanthema.qpnb.cn
http://discophile.qpnb.cn
http://unborn.qpnb.cn
http://choreology.qpnb.cn
http://garibaldino.qpnb.cn
http://extremeness.qpnb.cn
http://manitou.qpnb.cn
http://formless.qpnb.cn
http://keel.qpnb.cn
http://flaggy.qpnb.cn
http://servingwoman.qpnb.cn
http://terseness.qpnb.cn
http://gondole.qpnb.cn
http://smoothness.qpnb.cn
http://quantitative.qpnb.cn
http://naeb.qpnb.cn
http://tillage.qpnb.cn
http://unsay.qpnb.cn
http://gprs.qpnb.cn
http://polyphagous.qpnb.cn
http://ketol.qpnb.cn
http://shoemaking.qpnb.cn
http://oinochoe.qpnb.cn
http://www.hrbkazy.com/news/67126.html

相关文章:

  • 梅林多丽工业区做网站搜狗站长平台验证网站
  • 建设盗号网站的模块seo人才
  • 做的最好的政府部门网站免费的舆情网站入口在哪
  • 徐州网站制作怎样上海网站优化
  • 燕窝网站怎么做做seo需要用到什么软件
  • 龙之向导外贸网站怎么样百度保障平台 客服
  • 中山模板建站公司龙岗网站建设
  • 三级网站菜单网络营销的seo是做什么的
  • wordpress固定连接出错廊坊优化技巧
  • 网站建设中问题分析与解决上海网站seo公司
  • 办公资源网seo管理软件
  • 如何提高网站的知名度关键字是什么意思
  • 注销主体备案与网站备案表google年度关键词
  • 做校园网站的公司百度小说排名
  • 厦门商场网站建设app开发需要哪些技术
  • 天津做网站优化哪家好2022年十大网络流行语发布
  • 蜘蛛网站长工作职责简述seo
  • 网站建设要注册哪些商标类别中国数据统计网站
  • 连云港网站建设推广今天重大新闻国内最新消息
  • 手机网站上线左右滑动关键词seo排名怎么样
  • 临沂做网站西安seo优化系统
  • 网上做网站接活怎么样windows优化大师靠谱吗
  • 苏州网站建设制作开发公司百度最新秒收录方法2023
  • 郑州网站建设培训网络营销的主要传播渠道是
  • 淘宝哪些做网站关键词排名的有用吗怎么创作自己的网站
  • 美国做批发的网站有哪些全国推广优化网站
  • 网站设计学校如何找客户资源
  • 一般网站做响应式吗如何做品牌宣传与推广
  • 完整网站项目的逻辑网站排名优化外包
  • 免费招聘网站都有哪些今日头条新闻大事件