前言
通常在我们做接口测试的时候,我们是不是需要去看接口的响应数据是否与我们期望的值相匹配。Postman 就提供了这个功能,我们可以使用 JavaScript 为 Postman API
请求编写 Tests 脚本。
那么我们以登录的接口为例
接口响应的数据为:
{
"code": 200,
"data": {
"firstLogin": true,
"token": "b2d08847c393f7f15b654f54bebdc0d2ce72b3d3",
"userBizInfoEntity": {
"accountType": 0,
"adSource": "",
"bizType": 1,
"deleteFlag": false,
"gmtCreated": 1612357476000,
"gmtModified": 1621236421000,
"marketChannel": "weixin",
"mobile": "188****7063",
"nickname": "七月",
"openid": "",
"subBizType": 101