mock数据

1.回归集成包时,需要验证新用户pin的功能,但集成包环境的数据不能清除,需要mock数据,替代线上的host成预发host:

  使用fiddler的具体语句为:

  regex:^https://api.m.jd.com(?<args>.*)$

  https://beta-api.m.jd.com${args}

 

 

 

2.测试会场的时候,用到通用复合接口,抓包的数据里http请求+host 后面不带functionId,functionId在inspector的webform里可以看到,这种类型的请求可以这么mock:

fiddler语句 :

URLWithBody:api.m.jd.com regex:.*2142631*

d:\我的文档\桌面\fiddler\85_Response.txt

第二句指的是替代的response文件;

 

 

whistle语句:

/api.m.jd.com/ includeFilter://b:13886062 rawfile://D:\我的文档\桌面\client.action

 

 

 

 

用whistle mock数据的时候response信息需要适当调整:

HTTP/1.1 200 

Server: nginx/1.11.6

Date: Sat, 17 Oct 2020 11:06:22 GMT

Content-Type: application/json;charset=utf-8

Transfer-Encoding: chunked

Connection: close

Access-Control-Allow-Origin: https://h5.m.jd.com

Access-Control-Allow-Credentials: true

Access-Control-Expose-Headers: X-API-Request-Id

X-API-Request-Id: 180159573-10099-1602932782630

X-API-Wl-Message: 0

Expires: Sat, 17 Oct 2020 11:06:22 GMT

Cache-Control: max-age=0

posted on 2022-04-01 17:13  miss斯娃  阅读(147)  评论(0)    收藏  举报