漫游测试之性能测试(3.1、Loadrunner的介绍-3.1.3.2 web_custom_request)

web_custom_request()函数是一个可以用于自定义http请求的万能函数,具有web_link()web_url()web_submit_data()函数的功能。

简介如下:

web_custom_request("requestUrlName",  -- 本次请求参数的名称,这个是自定义的

  "URL=http://107.x.x.104:xx/functionName",  -- 路由地址

  "Method=POST",  -- HTTP请求的方法,如果是HTTP,则Body字段不填写

  "Resource=0",  -- Resource这个字段只对CSSJSIMG等资源类有用,为0时,即不下载资源,如果为1,则每次都下载资源

  "RecContentType=text/html",   

  "Referer=",    -- 对应包头中的Referer字段

  "Snapshot=t152.inf",

  "Mode=HTTP",  -- 协议是通过HTTP的,一般不用改

  "EncType=application/x-www-form-urlencoded; charset=UTF-8",  -- 对应抓包工具中的Content-Type字段的值,可能有时为application/json;charset=UTF-8

  "Body=cityName=深圳",  -- 该请求的Body内容

  LAST);

其它字段的解释,可以在Loadruuner中输入web_custom_request然后按F1进行查看。如果,我们模拟访问CSDN,在Loadrunner使用该函数,如下即可:

 

模拟该请求,只需:

web_custom_request("blog.csdn.net",

"URL=http://blog.csdn.net/qwentest",

"Method=GET",

"Resource=0",

"RecContentType=text/html",

"Referer=",

"Snapshot=t152.inf",

"Mode=HTTP",

"EncType=application/x-www-form-urlencoded; charset=UTF-8",

"Body=",

LAST);

猜你喜欢

转载自blog.csdn.net/womengdoushizhongguo/article/details/80469487