友善交流技术...

loadrunner 三种post请求

上一篇 / 下一篇  2015-02-12 13:25:07 / 个人分类:性能测试专题

测试中经常会遇到不知道使用那种类型的post请求格式. 那么怎么办呢?

 Loadrunner三种post格式的请求

1 web_custom_request

intweb_custom_request(const char *RequestName, <List of Attributes>,
[EXTRARES, <List of Resource Attributes>,] LAST ); 

 第一种:自定义http格式的请求,可以是任何的方式或是body如下:

web_custom_request("xxxxx",

                            "URL=http://xxxx.xxxx.xxx",

                            "Method=POST",

                            "Resource=0",

                            "Snapshot=t10.inf",

                            "Mode=HTML",

                            "EncType=application/x-www-form-urlencoded",

                            "Body={\"sign\": \"{sign}\",\"token\": \"68C116cd449034db04C8ff2B7271B345\",\"time\": \"123456\",\"params\": {\"city_id\": \"2419\",\"advert_id\": \"2139\",\"offset\": \"0\",\"pagesize\": \"10\"}}",LAST);

 

2 web_submit_data 

intweb_submit_data(const char *StepName, const char *Action,<List of Attributes>, ITEMDATA, <List of data>, [ EXTRARES, <List of Resource Attributes>,] LAST ); 

第二种提交:postget请求. 

web_submit_data("pay_check.php",

         "Action=http://buyinterface.{url}/v1/pay_check.php",

                            "Method=POST",

                            "RecContentType=text/html",

                            "Snapshot=t7.inf",

                            "Mode=HTML",

                            ITEMDATA,

                            "Name=my_id", "Value={myid}", ENDITEM,

                            "Name=trade_no", "Value={trano_1}", ENDITEM,      

                            LAST);

3 web_submit_form.

intweb_submit_form(const char *StepName, <List of Attributes>, <List of Hidden Fields>, ITEMDATA, <List of Data Fields>, [ EXTRARES, <List of Resource Attributes>,] LAST );

第三种:只支持post请求

web_submit_form("db2net.exe",

    ITEMDATA,

    "name=library.TITLE", "value=Practical UNIX Security", ENDITEM,

    "name=library.AUTHOR_S_", "value=Garfinkel", ENDITEM,

    "name=library.SUBJECTS", "value=", ENDITEM,

    LAST );

 遇到不知道怎么办时,最好问下开发,支持什么格式.


 
 

TAG:

让测试飞起来的个人空间 引用 删除 让测试飞起来   /   2018-03-06 10:38:12
5
 

评分:0

我来说两句

Open Toolbar