loadrunner 录制PUT DELETE UPDATE 操作

loadrunner 在模拟移动端接口发送的时候,可能无法进行录制,这个时候可能需要手工进行录制,采用web_custom_request方法即可,查看loadrunner helper中关于该函数的说明:

Allows you to create a custom HTTP request with any method supported by HTTP. 

 

 

下面是restful中的一个实例:

web_add_header("client_secret", "REMOTE_LINK_AND_OAUTH_2");
web_add_header("Accept", "application/json");


web_reg_save_param("PIN_JWT",
"LB=\"JWT\": \"",
"RB=\"",
"Ord=1",
"Search=All", //Headers,Body
LAST);

web_reg_find("Text=timestamp",
"SaveCount=EncodePasswordGrant_COUNT",
LAST );


web_custom_request("EncodePasswordGrant",
"URL=https://xxxxxx:13443/internal/util/jwt/encode/data",
"Method=POST",
"Resource=1",
"Referer=",
"Mode=HTML",
"EncType=application/json",
"Body={\"nonce\": \"{pingetnonce}\",\"timestamp\": \"{pintimestamp}\",\"client_id\": \"REMOTE_LINK_AND_OAUTH_2\",\"credential_type\": \"PIN\",\"device_id\": \"{vin}\",\"credential\": \"{pin}\"}",
LAST);

 

其中method的参数根据help的定义(Method – any method supported by the HTTP protocol.)我们可以放支持任何http协议的方法。后续的脚本中我也尝试过PUT和DELETE的请求,服务器均能接受并处理。

这里说明下,由于我的希望接收的内容为jason,所以我在header中定义了web_add_header("Accept", "application/json");

 

posted @ 2016-08-08 16:27  soultank  阅读(1061)  评论(0编辑  收藏  举报