张小胖 发表于 2017-6-16 10:29:56

loadrunner发送http请求的原理是怎样的?

最近练习的时候发现,loadrunner录制的脚本中第一个请求服务器返回的cookie能够自动加到下一个请求header中,形式是:JESSIONID=AJHDSJASJSJASJKSKAJ231JHHJ123的形式,但是脚本中我没有添加关于cookie的函数操作,为什么loadrunner能够自动实现这个。我不是很明白有懂的大神能否帮忙解答一下。
第二点不明白的地方是,loadrunner本质是以什么方式在模拟浏览器发送请求?
下面是录制的登录功能的脚本:
Action()
{

        web_url("userLoginController.do",
                "URL=http://192.168.3.140:8080/ele_con/userLoginController.do?login",
                "TargetFrame=",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=",
                "Snapshot=t1.inf",
                "Mode=HTML",
                EXTRARES,
                "URL=http://www.bing.com/favicon.ico", ENDITEM,
                "URL=../favicon.ico", ENDITEM,
                "URL=webpage/buss/elecon/common/images/loading.gif", "Referer=http://192.168.3.140:8080/ele_con/userLoginController.do?login", ENDITEM,
                LAST);

        web_submit_data("userLoginController.do_2",
                "Action=http://192.168.3.140:8080/ele_con/userLoginController.do?checkuser",
                "Method=POST",
                "TargetFrame=",
                "RecContentType=text/html",
                "Referer=http://192.168.3.140:8080/ele_con/userLoginController.do?login",
                "Snapshot=t2.inf",
                "Mode=HTML",
                ITEMDATA,
                "Name=userName", "Value=wuqingyun725", ENDITEM,
                "Name=password", "Value=Wu_123456", ENDITEM,
                "Name=keyid", "Value=", ENDITEM,
                "Name=flag", "Value=1", ENDITEM,
                LAST);

        web_url("userLoginController.do_3",
                "URL=http://192.168.3.140:8080/ele_con/userLoginController.do?login",
                "TargetFrame=",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=",
                "Snapshot=t3.inf",
                "Mode=HTML",
                EXTRARES,
                "URL=upload/plug-in/accordion/images/create.png", "Referer=http://192.168.3.140:8080/ele_con/userLoginController.do?login", ENDITEM,
                "URL=upload/plug-in/accordion/images/sign.png", "Referer=http://192.168.3.140:8080/ele_con/userLoginController.do?login", ENDITEM,
                "URL=upload/plug-in/accordion/images/con_withdraw.png", "Referer=http://192.168.3.140:8080/ele_con/userLoginController.do?login", ENDITEM,
                "URL=upload/plug-in/accordion/images/con_new.png", "Referer=http://192.168.3.140:8080/ele_con/userLoginController.do?login", ENDITEM,
                "URL=webpage/buss/elecon/common/images/right_arrow.png", "Referer=http://192.168.3.140:8080/ele_con/userLoginController.do?login", ENDITEM,
                "URL=upload/plug-in/accordion/images/con_track.png", "Referer=http://192.168.3.140:8080/ele_con/userLoginController.do?login", ENDITEM,
                "URL=upload/plug-in/accordion/images/con_back.png", "Referer=http://192.168.3.140:8080/ele_con/userLoginController.do?login", ENDITEM,
                "URL=upload/plug-in/accordion/images/complete.png", "Referer=http://192.168.3.140:8080/ele_con/userLoginController.do?login", ENDITEM,
                "URL=upload/plug-in/accordion/images/abort.png", "Referer=http://192.168.3.140:8080/ele_con/userLoginController.do?login", ENDITEM,
                "URL=upload/plug-in/accordion/images/account.png", "Referer=http://192.168.3.140:8080/ele_con/userLoginController.do?login", ENDITEM,
                "URL=upload/plug-in/accordion/images/relieve.png", "Referer=http://192.168.3.140:8080/ele_con/userLoginController.do?login", ENDITEM,
                "URL=upload/plug-in/accordion/images/sign_name.png", "Referer=http://192.168.3.140:8080/ele_con/userLoginController.do?login", ENDITEM,
                "URL=upload/plug-in/accordion/images/package.png", "Referer=http://192.168.3.140:8080/ele_con/userLoginController.do?login", ENDITEM,
                "URL=upload/plug-in/accordion/images/collect.png", "Referer=http://192.168.3.140:8080/ele_con/userLoginController.do?login", ENDITEM,
                "URL=upload/plug-in/accordion/images/down_center.png", "Referer=http://192.168.3.140:8080/ele_con/userLoginController.do?login", ENDITEM,
                "URL=upload/plug-in/accordion/images/tmp_center.png", "Referer=http://192.168.3.140:8080/ele_con/userLoginController.do?login", ENDITEM,
                "URL=webpage/buss/elecon/common/images/icon_1.png", "Referer=http://192.168.3.140:8080/ele_con/userLoginController.do?login", ENDITEM,
                "URL=webpage/buss/elecon/common/images/con_create.png", "Referer=http://192.168.3.140:8080/ele_con/userLoginController.do?login", ENDITEM,
                "URL=webpage/buss/elecon/common/images/con_sign.png", "Referer=http://192.168.3.140:8080/ele_con/userLoginController.do?login", ENDITEM,
                "URL=webpage/buss/elecon/common/images/con_down.png", "Referer=http://192.168.3.140:8080/ele_con/userLoginController.do?login", ENDITEM,
                "URL=webpage/buss/elecon/common/images/con_suspen.png", "Referer=http://192.168.3.140:8080/ele_con/userLoginController.do?login", ENDITEM,
                "URL=webpage/buss/elecon/common/images/con_valid.png", "Referer=http://192.168.3.140:8080/ele_con/userLoginController.do?login", ENDITEM,
                "URL=webpage/buss/elecon/common/images/con_relieve.png", "Referer=http://192.168.3.140:8080/ele_con/userLoginController.do?login", ENDITEM,
                "URL=upload/plug-in/accordion/images/mai_list.png", "Referer=http://192.168.3.140:8080/ele_con/userLoginController.do?login", ENDITEM,
                "URL=webpage/buss/elecon/common/images/per_temp_s.png", "Referer=http://192.168.3.140:8080/ele_con/userLoginController.do?login", ENDITEM,
                "URL=webpage/buss/elecon/common/images/collec.png", "Referer=http://192.168.3.140:8080/ele_con/userLoginController.do?login", ENDITEM,
                "URL=plug-in/jquery-ui/images/ui-icons_444444_256x240.png", "Referer=http://192.168.3.140:8080/ele_con/userLoginController.do?login", ENDITEM,
                "URL=webpage/buss/elecon/common/images/comp_temp_s.png", "Referer=http://192.168.3.140:8080/ele_con/userLoginController.do?login", ENDITEM,
                "URL=webpage/buss/elecon/common/images/botm_arrow.png", "Referer=http://192.168.3.140:8080/ele_con/userLoginController.do?login", ENDITEM,
                LAST);

        web_url("userLoginController.do_4",
                "URL=http://192.168.3.140:8080/ele_con/userLoginController.do?refreshMenuContractNum&_=1497498472690",
                "TargetFrame=",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=http://192.168.3.140:8080/ele_con/userLoginController.do?login",
                "Snapshot=t4.inf",
                "Mode=HTML",
                EXTRARES,
                "URL=plug-in/jquery-ui/images/ui-icons_777777_256x240.png", "Referer=http://192.168.3.140:8080/ele_con/userLoginController.do?login", ENDITEM,
                LAST);

return 0;
}

msnshow 发表于 2017-6-16 13:29:12

这个底层的实现原理还真不清楚,毕竟不是开源产品,没有源码可看

清楚是怎么用的就好了,没必要管它是怎么实现的

菜鸟@大虾 发表于 2017-6-16 13:32:03

1作为一款商业工具,LR可自己管理cookie;
2性能测试是发送报文 使用什么浏览器都木有关系,不用关心这个。

jingzizx 发表于 2017-6-17 09:55:25

一个应该时内部实现机制
另一个应该是调用的浏览器的一些函数吧,具体就不清楚了

张小胖 发表于 2017-6-19 08:48:30

谢谢大家:)

张小胖 发表于 2017-6-19 14:56:18

菜鸟@大虾 发表于 2017-6-16 13:32
1作为一款商业工具,LR可自己管理cookie;
2性能测试是发送报文 使用什么浏览器都木有关系,不用关心 ...

一般都是使用web_add_cookie函数,提交请求前添加到请求头中,这个我明白,但就是弄不明白没有这个函数,它是如何自动添加到下一个请求中的。lr自己管理cookie,可否有相关的资料,我查找了很多 都没找到。:L:handshake
页: [1]
查看完整版本: loadrunner发送http请求的原理是怎样的?