标签:containe ati uid wrapper grant file class ant 项目
打开cmd或cmder,输入命令:pip3 install httprunner
安装完成输入命令:hrun -V或hrun -h
检查安装是否成功
1)新建test.yaml文件(以登录+关闭房间接口为例)
编写代码如下:
- config:
name: allo
request:
base_url: ***(此处需替换为自己项目的域名)
- test:
name: 获取token
request:
url: ***(需替换为自己项目的接口路径)
method: POST
params:
phone: 852-94400040
password: 1n6ysSKOMnFAwgt7a5hAGQ==
client_id: erban-client
client_secret: uyzjdhds
deviceId: db497e89a66e417ba80e94265e79b710
grant_type: password
ispType: 65535
validate:
- eq: [status_code,200]
extract:
- Token: content.data.access_token
- test:
name: 获取ticket
request:
url: ***(需替换为自己下面的接口路径)
method: POST
params:
access_token: $Token
app: tutu
appVersion: 1.1.1
channel: appstore_pudding
deviceId: db497e89a66e417ba80e94265e79b710
ispType: 65535
issue_type: multi
model: iPhone10%2C3
netType: 2
os: iOS
osVersion: 12.1.4
pub_sign: F8CCC4E6934C34742F2D80D41C7F9AD3
pub_timestamp: 1554281974000
uuid: beb7d957-087a-4a58-b1be-cc13e7648330
validate:
- eq: [status_code,200]
extract:
- Ticket: content.data.tickets.0.ticket
- test:
name: 关闭房间
request:
url: ***(需替换为自己下面的接口路径)
method: POST
params:
uid: 61004572
ticket: $Ticket
validate:
- eq: [status_code,200]
2)运行测试用例
cd到test.yaml文件所在目录,输入命令:hrun test.yaml
标签:containe ati uid wrapper grant file class ant 项目
原文地址:https://www.cnblogs.com/wanyuan/p/12869104.html