loadrunner手写请求

本文介绍了如何在LoadRunner中使用web_custom_request函数手动编写HTTP请求。通过示例脚本,详细展示了POST请求的配置,包括URL、请求体、编码类型等参数设置,适用于模拟登录等场景。

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

和录制脚本不一样的是,lr支持手写请求,利用函数手写,也很方便

步骤

design--insertscript 我常用的web_custom_request函数

分别添加这个请求的名字

        方式

        完整地址

        targetframe没填写过

        body写请求体,注意要对双引号利用\转义,中间空格删除

        录制模式 http

        源代码:二进制勾选

        encoding type:编码类型


源代码附上

注释部分是录制的请求,其他手写的请求

处于隐私 部分地址删除

Action()
{
    /*web_custom_request("userLogin",
        "URL=http://青帮地址",
        "Method=POST",
        "TargetFrame=",
        "Resource=0",
        "RecContentType=text/plain",
        "Referer=",
        "Snapshot=t27.inf",
        "Mode=HTTP",
        "EncType=application/json",
        "Body={\"phone\":\"1558\",\"passWord\":\"123456\"}",
        LAST);
    web_custom_request("/app/login",
        "URL=http://农场地址/app/login",
        "Method=POST",
        "TargetFrame=",
        "Resource=0",
        "RecContentType=text/plain",
        "Referer=",
        "Snapshot=t27.inf",
        "Mode=HTTP",
        "EncType=application/json",
        "Body={\"phone\":\"1558\",\"password\":\"123456\"}",
        LAST);
    web_custom_request("/app/phoneLogin",
        "URL=http://蜜獾地址/app/phoneLogin",
        "Method=POST",
        "TargetFrame=",
        "Resource=0",
        "RecContentType=text/plain",
        "Referer=",
        "Snapshot=t27.inf",
        "Mode=HTTP",
        "EncType=application/json",
    "Body={\"telephone\":\"1558\",\"type\":\"1\",\"pwd\":\"123456\",\"phoneType\":\"1\",\"token\":\"c7b5a3163509b0374ac0057a386a6baf\"}",
        LAST);*/
    web_custom_request("web_custom_request",
        "URL=http://青帮/app/userLogin",
        "Method=post",
        "TargetFrame=",
        "Resource=0",
        "RecContentType=text/plain",
        "EncType=application/json",
        "Referer=",
        "Mode=HTTP",
        "BodyBinary={\"phone\":\"155\",\"passWord\":\"123456\"}",
        LAST);

    web_custom_request("shouxie",
        "URL=http://青帮/app/userLogin",
        "Method=post",
        "TargetFrame=",
        "Resource=1",
        "Referer=",
        "Mode=HTTP",
        "EncType=application/json",
        "BodyBinary={\"phone\":\"1558\",\"passWord\":\"123456\"}",
        LAST);
    return 0;
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值