loadrunner 三种post请求

本文介绍了LoadRunner中三种POST请求的方法:web_custom_request用于自定义HTTP请求;web_submit_data支持GET和POST请求;web_submit_form仅支持POST请求。在不确定使用哪种格式时,建议咨询开发人员。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

测试中经常会遇到不知道使用那种类型的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 ); 

第二种提交:支post和get请求. 

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 );

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


转载于:http://www.51testing.com/html/85/132585-1467147.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值