JMeter接口测试之HTTP Post请求实例
2021-05-05 08:28
标签:set 配置 XML ofo inf 说明 star step visit 1、接口说明: 调用商品到购物车接口 2、请求方式: HTTP POST请求 3. 接口地址: /ecshop/upload/flow.php?step=add_to_cart 4. 请求参数: 1) 输入参数: JSON数据格式: 2) 请求示例: POST /ecshop/upload/flow.php?step=add_to_cart 5. 返回参数 1) 响应参数: 2) 响应示例: 1.在“Test Plan”节点上右键,选择Add-->Threads(users)-- Thread Group; JMeter接口测试之HTTP Post请求实例 标签:set 配置 XML ofo inf 说明 star step visit 原文地址:https://blog.51cto.com/14645850/2462408
HTTP/1.1
Host: 192.168.126.134
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64;
rv:35.0) Gecko/20100101 Firefox/35.0
Accept:
text/html,application/xhtml+xml,application/xml;q=0.
9,/;q=0.8
Accept-Language: zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Content-Type: application/x-www-form-urlencoded;
charset=UTF-8
Referer:
http://192.168.126.134/ecshop/upload/goods.php?id=1
Content-Length: 69
Cookie: ECS[history]=1%2C17%2C9%2C5%2C8;
ECS[display]=grid; ECS[visit_times]=2;
ECS_ID=e1d0459a234edc14230c8e8c3f12251bb699bd86
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache
goods={"quick":1,"spec":
["237"],"goods_id":1,"number":"1","parent":0}测试步骤
2.在“Thread Group”节点上右键,选择Add-->Sampler-->HTTP
Request;
3.在“HTTP Request”节点上右键,选择Add-->Listener-->View
Results Tree;
4.选中“HTTP Request”对HTTP请求进行配置;
5.点击“Save”,保存测试计划;
6.点击“Start”,运行JMeter测试HTTP Request配置
请求参数一般放在“Body data”选项卡中:
goods={"quick":1,"spec":
["237"],"goods_id":1,"number":"1","parent":0}
本例中请求参数为查询字符串,因此还可以放在“Parameters“选项卡中:
文章标题:JMeter接口测试之HTTP Post请求实例
文章链接:http://soscw.com/index.php/essay/82654.html