标签:ica short 参数变量 center cti query 增加 port return
1.关键字:post请求
*** Settings *** Library RequestsLibrary *** Keywords *** post.request [Arguments] ${url} ${api} ${data} ${headers} [Documentation] post请求封装 #创建session create session _session ${url} headers=${headers} #发送请求 ${respose} post request _session ${api} data=${data} headers=${headers} #校验请求是否成功 Should Be Equal As Strings ${respose.status_code} 200 ${json}= set variable ${respose.json()} #返回请求结果 [Return] ${json}
2.关键字:接口调用post请求:
*** Settings *** Resource ../Public_KeyWords/post请求.robot *** Keywords *** com.souche.shop.api.TgcShopOperateService [Arguments] ${all} ${headers}= create dictionary _dubbo_token=souche_http_token _method_name=addTgcShop Content-Type=application/x-www-form-urlencoded; charset=UTF-8 ${resq} post.request http://172.17.40.200:20881 /com.souche.shop.api.TgcShopOperateService ${all} ${headers} [Return] ${resq}
3.关键字:连接数据库
*** Settings *** Library DatabaseLibrary *** Keywords *** connect.database [Arguments] ${base_name} ${user_name} ${password} ${host} ${port} #连接数据库 connect to database using custom params pymysql database=‘${base_name}‘,user=‘${user_name}‘,password=‘${password}‘,host=‘${host}‘,port=${port}
4.接口参数变量:
#-*- coding: utf-8 -*- #添加弹个车店铺 variables={ "name":"测试店",#店铺名称 "short_name":"测试店", #对外简称, "nickname":"测试店", #对内简称, "isTest":"1",#是否是测试店 "phone":"13251028260",#手机号 "address":"北京王府井",#‘地址‘, "area":"西直门128号" ,#地区,省市区拼接, "province":"北京",#省 "city":"北京",#市 "region":"东城区",#地区 "address_call":"0571-3399456",#座机号码 "coordinate":"120.288383,30.203987", #高德坐标 }
5.测试case:
*** Settings *** Documentation 添加弹个车店铺 Variables ../Resource/add_tgcshop.py Resource ../KeyWords/Tgcshop_add.robot Resource ../Public_KeyWords/connect_database.robot *** Test Cases *** 增加弹个车店铺 ${variable}= evaluate json.dumps(${variables}, ensure_ascii=False, encoding=‘UTF-8‘) json log ${variable} ${par}= create dictionary shopQO=${variable} ${req}= com.souche.shop.api.TgcShopOperateService ${par} ${result}= set variable ${req[‘data‘][‘success‘]} should be equal as strings ${result} True connect.database souche_center root dpjA8Z6XPXbvos 115.29.10.121 3306 ${code}= set variable ${req[‘data‘][‘data‘]} ${check}= query select * from tgc_shop where code=${code}
标签:ica short 参数变量 center cti query 增加 port return
原文地址:https://www.cnblogs.com/jason89/p/10464894.html