loadrunner设置参数
Posted yuner_123
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了loadrunner设置参数相关的知识,希望对你有一定的参考价值。
录制完脚本回放成功以后,要设置参数。设置参数的目的就是能对系统施加性能压力。通过不同的用户登陆后进行相同的操作,这样就可以尽可能的模拟出真实的情况。
下面的展示的是录制的action的脚本
[cpp] view plain copy
- <p>/* -------------------------------------------------------------------------------
- Script Title :
- Script Description :
- Recorder Version : 8859
- ------------------------------------------------------------------------------- */</p><p>vuser_init()
- </p><p> web_url("index.jsp",
- "URL=http://10.135.27.24/ZZJYT/login/index.jsp",
- "Resource=0",
- "RecContentType=text/html",
- "Referer=",
- "Snapshot=t1.inf",
- "Mode=HTML",
- LAST);</p><p> web_submit_form("yanzheng.jsp",
- "Snapshot=t2.inf",
- ITEMDATA,
- "Name=username", "Value=<span style="color:#ff0000;">username</span>", ENDITEM,
- "Name=password", "Value=123456", ENDITEM,
- "Name=login", "Value=登录", ENDITEM,
- EXTRARES,
- "Url=/ext-3.1.0/resources/images/default/panel/corners-sprite.gif", "Referer=http://10.135.27.24/ZZJYT/login/frame.jsp", ENDITEM,
- "Url=/ext-3.1.0/resources/images/default/panel/top-bottom.gif", "Referer=http://10.135.27.24/ZZJYT/login/frame.jsp", ENDITEM,
- "Url=/ext-3.1.0/resources/images/default/panel/tool-sprites.gif", "Referer=http://10.135.27.24/ZZJYT/login/frame.jsp", ENDITEM,
- "Url=/ext-3.1.0/resources/images/default/panel/left-right.gif", "Referer=http://10.135.27.24/ZZJYT/login/frame.jsp", ENDITEM,
- "Url=/ext-3.1.0/resources/images/default/dd/drop-no.gif", "Referer=http://10.135.27.24/ZZJYT/login/frame.jsp", ENDITEM,
- "Url=/ext-3.1.0/resources/images/default/tree/s.gif", "Referer=http://10.135.27.24/ZZJYT/login/frame.jsp", ENDITEM,
- "Url=/ext-3.1.0/resources/images/default/tree/folder.gif", "Referer=http://10.135.27.24/ZZJYT/login/frame.jsp", ENDITEM,
- "Url=/ext-3.1.0/resources/images/default/tabs/tab-strip-bg.gif", "Referer=http://10.135.27.24/ZZJYT/login/frame.jsp", ENDITEM,
- "Url=/ext-3.1.0/resources/images/default/tree/arrows.gif", "Referer=http://10.135.27.24/ZZJYT/login/frame.jsp", ENDITEM,
- "Url=/ext-3.1.0/resources/images/default/tabs/tabs-sprite.gif", "Referer=http://10.135.27.24/ZZJYT/login/frame.jsp", ENDITEM,
- "Url=/ext-3.1.0/resources/images/default/tree/loading.gif", "Referer=http://10.135.27.24/ZZJYT/login/frame.jsp", ENDITEM,
- "Url=/ext-3.1.0/resources/images/default/tree/leaf.gif", "Referer=http://10.135.27.24/ZZJYT/login/frame.jsp", ENDITEM,
- "Url=/ext-3.1.0/resources/images/default/tree/folder-open.gif", "Referer=http://10.135.27.24/ZZJYT/login/frame.jsp", ENDITEM,
- "Url=/ext-3.1.0/resources/images/default/tabs/tab-close.gif", "Referer=http://10.135.27.24/ZZJYT/login/frame.jsp", ENDITEM,
- LAST);</p><p> web_url("top.jsp",
- "URL=http://10.135.27.24/ZZJYT/login/top.jsp",
- "Resource=0",
- "RecContentType=text/html",
- "Referer=http://10.135.27.24/ZZJYT/login/frame.jsp",
- "Snapshot=t3.inf",
- "Mode=HTML",
- LAST);</p><p> web_url("noticeList.jsp",
- "URL=http://10.135.27.24/ZZJYT/login/alarm/noticeList.jsp",
- "Resource=0",
- "RecContentType=text/html",
- "Referer=http://10.135.27.24/ZZJYT/login/frame.jsp",
- "Snapshot=t4.inf",
- "Mode=HTML",
- EXTRARES,
- "Url=/ext-3.1.0/resources/images/default/toolbar/bg.gif", ENDITEM,
- "Url=/ext-3.1.0/resources/images/default/qtip/tip-anchor-sprite.gif", ENDITEM,
- "Url=/ext-3.1.0/resources/images/default/qtip/tip-sprite.gif", ENDITEM,
- "Url=/ext-3.1.0/resources/images/default/grid/grid3-hrow.gif", ENDITEM,
- "Url=/ext-3.1.0/resources/images/default/grid/col-move-top.gif", ENDITEM,
- "Url=/ext-3.1.0/resources/images/default/grid/grid3-hd-btn.gif", ENDITEM,
- "Url=/ext-3.1.0/resources/images/default/form/text-bg.gif", ENDITEM,
- "Url=/ext-3.1.0/resources/images/default/grid/col-move-bottom.gif", ENDITEM,
- "Url=/ext-3.1.0/resources/images/default/grid/grid-blue-split.gif", ENDITEM,
- "Url=/ext-3.1.0/resources/images/default/button/btn.gif", ENDITEM,
- "Url=/ext-3.1.0/resources/images/default/grid/page-first-disabled.gif", ENDITEM,
- "Url=/ext-3.1.0/resources/images/default/grid/page-prev-disabled.gif", ENDITEM,
- "Url=/ext-3.1.0/resources/images/default/grid/page-next-disabled.gif", ENDITEM,
- "Url=/ext-3.1.0/resources/images/default/grid/page-last-disabled.gif", ENDITEM,
- "Url=/ext-3.1.0/resources/images/default/grid/refresh.gif", ENDITEM,
- "Url=/ext-3.1.0/resources/images/default/box/tb-blue.gif", ENDITEM,
- "Url=/ext-3.1.0/resources/images/default/grid/refresh-disabled.gif", ENDITEM,
- "Url=/ext-3.1.0/resources/images/default/grid/loading.gif", ENDITEM,
- "Url=/ext-3.1.0/resources/images/default/grid/grid3-special-col-bg.gif", ENDITEM,
- LAST);</p><p> web_submit_data("TreePanel_Data.jsp",
- "Action=http://10.135.27.24/ZZJYT/jBean/TreePanel_Data.jsp",
- "Method=POST",
- "RecContentType=text/html",
- "Referer=http://10.135.27.24/ZZJYT/login/frame.jsp",
- "Snapshot=t5.inf",
- "Mode=HTML",
- ITEMDATA,
- "Name=node", "Value=0", ENDITEM,
- LAST);</p><p> web_submit_data("noticeList_Data.jsp",
- "Action=http://10.135.27.24/ZZJYT/jBean/login/alarm/noticeList_Data.jsp",
- "Method=POST",
- "RecContentType=text/html",
- "Referer=http://10.135.27.24/ZZJYT/login/alarm/noticeList.jsp",
- "Snapshot=t6.inf",
- "Mode=HTML",
- ITEMDATA,
- "Name=start", "Value=0", ENDITEM,
- "Name=limit", "Value=15", ENDITEM,
- "Name=msgword", "Value=", ENDITEM,
- LAST);</p><p> web_submit_data("TreePanel_Data.jsp_2",
- "Action=http://10.135.27.24/ZZJYT/jBean/TreePanel_Data.jsp",
- "Method=POST",
- "RecContentType=text/html",
- "Referer=http://10.135.27.24/ZZJYT/login/frame.jsp",
- "Snapshot=t7.inf",
- "Mode=HTML",
- ITEMDATA,
- "Name=node", "Value=B1", ENDITEM,
- LAST);</p><p> web_submit_data("TreePanel_Data.jsp_3",
- "Action=http://10.135.27.24/ZZJYT/jBean/TreePanel_Data.jsp",
- "Method=POST",
- "RecContentType=text/html",
- "Referer=http://10.135.27.24/ZZJYT/login/frame.jsp",
- "Snapshot=t8.inf",
- "Mode=HTML",
- ITEMDATA,
- "Name=node", "Value=B1001", ENDITEM,
- LAST);</p><p> web_url("hr_xs_sjcj.jsp",
- "URL=http://10.135.27.24/ZZJYT/xsManager/hr_xs_sjcj.jsp",
- "Resource=0",
- "RecContentType=text/html",
- "Referer=http://10.135.27.24/ZZJYT/login/frame.jsp",
- "Snapshot=t9.inf",
- "Mode=HTML",
- EXTRARES,
- "Url=/ext-3.1.0/resources/images/default/form/trigger.gif", ENDITEM,
- "Url=/ext-3.1.0/resources/images/default/grid/page-next.gif", ENDITEM,
- "Url=/ext-3.1.0/resources/images/default/form/date-trigger.gif", ENDITEM,
- "Url=/ext-3.1.0/resources/images/default/grid/grid3-hrow-over.gif", ENDITEM,
- LAST);</p><p> return 0;
- </p>
其中红色部分则是需要参数化的部分
选取需要参数的部分,选择Replace With a Parameter
修改参数名以及参数类型后在加入参数值
加入参数
点击ok以后,参数化过程完成这样就可以运行脚本开始进行测试了。参数化过程比较简单困难的部分是选择参数运行的方式,包括Select next row, update alue on 这一部分都需要参考一些文章才行。
以上是关于loadrunner设置参数的主要内容,如果未能解决你的问题,请参考以下文章