码迷,mamicode.com
首页 > 其他好文 > 详细

loadrunner 日志中 输入参数化的值

时间:2016-07-03 23:02:56      阅读:1149      评论:0      收藏:0      [点我收藏+]

标签:

1、脚本中对用户名进行参数化后:如下(我的参数化文件中有三个值)

web_submit_data("authentication",
        "Action=http://www.moojnn.com/mojingcsp/authentication",
        "Method=POST",
        "TargetFrame=",
        "RecContentType=application/json",
        "Referer=http://www.moojnn.com/user/login.html",
        "Snapshot=t3.inf",
        "Mode=HTML",
        ITEMDATA,
        "Name=username", "Value={userName}", ENDITEM,
        "Name=password", "Value=e10adc3949ba59abbe56e057f20f883e", ENDITEM,
        EXTRARES,

2、在脚本中添加函数用以输入参数化的值:

    lr_output_message("用户名信息:",lr_eval_string("{userName}"));

3、设置一下运行时设置:F4键,因为系统默认输出标准日志,想要输出参数化的值需要修改默认配置,其余两个选项不要选择,否则信息太多了。

技术分享

4、我设置了迭代三次。

技术分享

5、于是我想看一下  这三次迭代的过程中,是否正确执行了三个参数化的值,于是需要做以上一些列的操作。

6、开始回放:

7、看回放日志:输入参数化的值在回放日志中可以查看。(可以看出三次迭代中使用了三个不同的用户名。)

Action.c(211): Notify: Parameter Substitution: parameter "userName" =  "18015505671"
Action.c(211): 用户名信息:
Action.c(213): Notify: Parameter Substitution: parameter "CorrelationParameter_1" =  "20000"
Action.c(213): Notify: Parameter Substitution: parameter "CorrelationParameter_1" =  "20000"
Action.c(207): web_add_cookie was successful      [MsgId: MMSG-26392]
Action.c(209): web_add_cookie was successful      [MsgId: MMSG-26392]
Action.c(211): Notify: Parameter Substitution: parameter "userName" =  "18013549123"
Action.c(211): 用户名信息:
Action.c(213): Notify: Parameter Substitution: parameter "CorrelationParameter_1" =  "20000"
Action.c(213): Notify: Parameter Substitution: parameter "CorrelationParameter_1" =  "20000"
Action.c(207): web_add_cookie was successful      [MsgId: MMSG-26392]
Action.c(209): web_add_cookie was successful      [MsgId: MMSG-26392]
Action.c(211): Notify: Parameter Substitution: parameter "userName" =  "15962256810"
Action.c(211): 用户名信息:
Action.c(213): Notify: Parameter Substitution: parameter "CorrelationParameter_1" =  "20000"
Action.c(213): Notify: Parameter Substitution: parameter "CorrelationParameter_1" =  "20000"

8、日志信息文件output.txt,windows环境,默认保存在脚本文件中;

     输出函数

1、lr_log_message()    // 输出信息,并记录到 output.txt 中
2、lr_output_message()    // 输出信息,不记录到日志文件中
3、lr_message()    // 输出信息,不记录到日志文件中
4、lr_error_message()    // 输出信息,不记录到日志文件中

9、可以看一下完整的回放日志,说明一开始准备好参数化的值,然后用到的时候再输入

Action.c(110): Downloading resource "http://www.moojnn.com/mojingcsp/public/page/list" (specified by argument number 26)      [MsgId: MMSG-26577]
Action.c(110): web_submit_data("lxb.gif") was successful, 8112 body bytes, 603 header bytes, 45 chunking overhead bytes      [MsgId: MMSG-26385]
Action.c(128): web_add_cookie was successful      [MsgId: MMSG-26392]
Action.c(130): web_add_cookie was successful      [MsgId: MMSG-26392]
Action.c(132): web_add_cookie was successful      [MsgId: MMSG-26392]
Action.c(134): Downloading resource "http://cclv.firefoxchina.cn/cclv/v2/patterns.json" (specified by argument number 18)      [MsgId: MMSG-26577]
Action.c(134): Downloading resource "http://www.moojnn.com/mojingcsp/public/scrollinfo/promotion" (specified by argument number 9)      [MsgId: MMSG-26577]
Action.c(134): Downloading resource "http://www.moojnn.com/mojingcsp/public/feedback/types" (specified by argument number 12)      [MsgId: MMSG-26577]
Action.c(134): Downloading resource "http://www.moojnn.com/mojingcsp/public/page/3/videos/top4?O_o=3o0w1f6sfji" (specified by argument number 15)      [MsgId: MMSG-26577]
Action.c(134): web_url("bpaId") was successful, 5597 body bytes, 1441 header bytes, 65 chunking overhead bytes      [MsgId: MMSG-26385]
Action.c(148): web_add_cookie was successful      [MsgId: MMSG-26392]
Action.c(150): web_add_cookie was successful      [MsgId: MMSG-26392]
Action.c(152): web_add_cookie was successful      [MsgId: MMSG-26392]
Action.c(154): web_add_cookie was successful      [MsgId: MMSG-26392]
Action.c(159): Registering web_reg_save_param_ex was successful      [MsgId: MMSG-26390]
Action.c(167): Notify: Parameter Substitution: parameter "userName" =  "18015505671"
Action.c(167): Notify: Saving Parameter "CorrelationParameter_1 = 20000".
Action.c(167): Downloading resource "http://pro.moojnn.com/lib/leaflet/leaflet.css?_d=1467120445822" (specified by argument number 17)      [MsgId: MMSG-26577]
Action.c(167): Downloading resource "http://pro.moojnn.com/css/icon/style.css?_d=1467120445822" (specified by argument number 20)      [MsgId: MMSG-26577]
Action.c(167): Downloading resource "http://pro.moojnn.com/css/common.css?_d=1467120445822" (specified by argument number 23)      [MsgId: MMSG-26577]
Action.c(167): Downloading resource "http://pro.moojnn.com/js/mjchart/theme/mjvi.css?_d=1467120445822" (specified by argument number 26)      [MsgId: MMSG-26577]
Action.c(167): Downloading resource "http://pro.moojnn.com/js/config.js" (specified by argument number 29)      [MsgId: MMSG-26577]
Action.c(167): Downloading resource "http://pro.moojnn.com/js/functions.js?_d=1467120445822" (specified by argument number 32)      [MsgId: MMSG-26577]
Action.c(167): Downloading resource "http://pro.moojnn.com/js/mjchart/mjvi.min.js?_d=1467120445822" (specified by argument number 35)      [MsgId: MMSG-26577]
Action.c(167): Downloading resource "http://pro.moojnn.com/js/common.js?_d=1467120445822" (specified by argument number 38)      [MsgId: MMSG-26577]
Action.c(167): Downloading resource "http://www.moojnn.com/static/js/csp.js?_=1467473737411" (specified by argument number 41)      [MsgId: MMSG-26577]
Action.c(167): web_submit_data("authentication") was successful, 632562 body bytes, 5049 header bytes, 35 chunking overhead bytes      [MsgId: MMSG-26385]
Action.c(190): Notify: Parameter Substitution: parameter "CorrelationParameter_1" =  "20000"
Action.c(190): Notify: Parameter Substitution: parameter "CorrelationParameter_1" =  "20000"
Action.c(190): Notify: Parameter Substitution: parameter "CorrelationParameter_1" =  "20000"
Action.c(190): Resource "http://www.moojnn.com/static/common.css?v=1467114587071" is in the cache already and will not be downloaded again      [MsgId: MMSG-26655]
Action.c(190): Resource "http://www.moojnn.com/static/common.js?v=1467114587071" is in the cache already and will not be downloaded again      [MsgId: MMSG-26655]
Action.c(190): Resource "http://www.moojnn.com/user/static/user.css?v=1467114587071" is in the cache already and will not be downloaded again      [MsgId: MMSG-26655]
Action.c(190): Resource "http://www.moojnn.com/user/static/user.js?v=1467114587071" is in the cache already and will not be downloaded again      [MsgId: MMSG-26655]
Action.c(190): Resource "http://www.moojnn.com/user/static/images/help/worsa.png" is in the cache already and will not be downloaded again      [MsgId: MMSG-26655]
Action.c(190): Resource "http://www.moojnn.com/user/static/images/help/ttime.png" is in the cache already and will not be downloaded again      [MsgId: MMSG-26655]
Action.c(190): Resource "http://www.moojnn.com/user/static/images/help/giftss.png" is in the cache already and will not be downloaded again      [MsgId: MMSG-26655]
Action.c(190): Resource "http://www.moojnn.com/user/static/images/help/erws.png" is in the cache already and will not be downloaded again      [MsgId: MMSG-26655]
Action.c(190): Resource "http://www.moojnn.com/user/static/images/help/twes.png" is in the cache already and will not be downloaded again      [MsgId: MMSG-26655]
Action.c(190): Downloading resource "http://hm.baidu.com/hm.js?177ebef2f9a9244c738b903eef680a83" (specified by argument number 10)      [MsgId: MMSG-26577]
Action.c(190): Downloading resource "http://z6.cnzz.com/stat.htm?id=1253524178&r=http%3A%2F%2Fwww.moojnn.com%2Fuser%2Flogin.html&lg=zh-cn&ntime=1467467462&cnzz_eid=1418985023-1467467462-http%3A%2F%2Fwww.moojnn.com%2F&showp=1366x768&p=http%3A%2F%2Fpro.moojnn.com%2Fprojects.html%23%2F%3FMoJing-Token%3D20000&t=&h=1&rnd=1141052232" (specified by argument number 13)      [MsgId: MMSG-26577]
Action.c(190): Downloading resource "http://pro.moojnn.com/mojing-server/user/login?MoJing-Token=20000" (specified by argument number 16)      [MsgId: MMSG-26577]
Action.c(190): Downloading resource "http://hm.baidu.com/hm.gif?cc=0&ck=1&cl=24-bit&ds=1366x768&et=0&fl=22.0&ja=0&ln=zh-CN&lo=0&lt=1467473654&nv=0&rnd=1523982449&si=177ebef2f9a9244c738b903eef680a83&st=4&su=http%3A%2F%2Fwww.moojnn.com%2Fuser%2Flogin.html&v=1.1.26&lv=3" (specified by argument number 19)      [MsgId: MMSG-26577]
Action.c(190): web_url("popup-help.html_2") was successful, 1797 body bytes, 1606 header bytes, 23 chunking overhead bytes      [MsgId: MMSG-26385]
Action.c(205): web_add_cookie was successful      [MsgId: MMSG-26392]
Action.c(207): web_add_cookie was successful      [MsgId: MMSG-26392]
Action.c(209): web_add_cookie was successful      [MsgId: MMSG-26392]
Action.c(211): Notify: Parameter Substitution: parameter "userName" =  "18015505671"
Action.c(211): 用户名信息:
Action.c(213): Notify: Parameter Substitution: parameter "CorrelationParameter_1" =  "20000"
Action.c(213): Notify: Parameter Substitution: parameter "CorrelationParameter_1" =  "20000"
Action.c(213): Found resource "http://pro.moojnn.com/projects/images/wschuan.png" in HTML "http://pro.moojnn.com/projects/projectlist.html?MoJing-Token=20000"      [MsgId: MMSG-26659]
Action.c(213): Warning -26627: HTTP Status-Code=404 (Not Found) for "http://pro.moojnn.com/projects/images/wschuan.png"      [MsgId: MWAR-26627]
Action.c(213): Downloading resource "http://pro.moojnn.com/mojing-server/project?MoJing-Token=20000" (specified by argument number 10)      [MsgId: MMSG-26577]
Action.c(213): web_url("projectlist.html") highest severity level was "warning", 7577 body bytes, 1676 header bytes, 19 chunking overhead bytes      [MsgId: MMSG-26387]
Action.c(225): Verification checks not enabled. web_find is skipped. See the Run-time settings/Preferences/Checks      [MsgId: MMSG-27197]
Action.c(225): web_find was successful      [MsgId: MMSG-26392]
Action.c(228): web_add_cookie was successful      [MsgId: MMSG-26392]
Action.c(230): Notify: Parameter Substitution: parameter "CorrelationParameter_1" =  "20000"
Action.c(230): Notify: Parameter Substitution: parameter "CorrelationParameter_1" =  "20000"
Action.c(230): Notify: Parameter Substitution: parameter "CorrelationParameter_1" =  "20000"
Action.c(230): Notify: Parameter Substitution: parameter "CorrelationParameter_1" =  "20000"
Action.c(230): Downloading resource "http://lxbjs.baidu.com/lxb.js?sid=7232801" (specified by argument number 9)      [MsgId: MMSG-26577]
Action.c(230): Downloading resource "http://www.moojnn.com/mojingcsp/public/user/status?O_o=1467473740865" (specified by argument number 12)      [MsgId: MMSG-26577]
Action.c(230): Downloading resource "http://pro.moojnn.com/css/icon/fonts/icomoon.ttf?4kq5qy" (specified by argument number 15)      [MsgId: MMSG-26577]
Action.c(230): Downloading resource "http://pro.moojnn.com/mojing-server/admin/user/getUid?MoJing-Token=20000" (specified by argument number 18)      [MsgId: MMSG-26577]
Action.c(230): Downloading resource "http://lxbjs.baidu.com/newFloat/log.gif?fType=2&name=lxb&t=1467473742394&uuid=a7a5d166-046b-420b-96ec-ea6e55509c9e" (specified by argument number 21)      [MsgId: MMSG-26577]
Action.c(230): Downloading resource "http://lxbjs.baidu.com/newFloat/_l.js?siteid=7232801&bdclickid=&bdcbid=f92ca554-e7d1-4392-886e-79227baedebd&refer_domain=&ishttp=1&t=1467473742438&callback=_lxb_jsonp_iq5bz6g6_" (specified by argument number 24)      [MsgId: MMSG-26577]
Action.c(230): Downloading resource "http://lxbjs.baidu.com/api/asset/api.js?t=1467473742498" (specified by argument number 27)      [MsgId: MMSG-26577]
Action.c(230): Downloading resource "http://lxbjs.baidu.com/newFloat/log.gif?fType=2&name=_l&t=1467473742989&uuid=a7a5d166-046b-420b-96ec-ea6e55509c9e" (specified by argument number 30)      [MsgId: MMSG-26577]
Action.c(230): web_url("v.js_2") was successful, 88497 body bytes, 2988 header bytes, 84 chunking overhead bytes      [MsgId: MMSG-26385]
Action.c(248): web_add_cookie was successful      [MsgId: MMSG-26392]
Action.c(250): Notify: Parameter Substitution: parameter "CorrelationParameter_1" =  "20000"
Action.c(250): Notify: Parameter Substitution: parameter "CorrelationParameter_1" =  "20000"
Action.c(250): Notify: Parameter Substitution: parameter "CorrelationParameter_1" =  "20000"
Action.c(250): Notify: Parameter Substitution: parameter "CorrelationParameter_1" =  "20000"
Action.c(250): Notify: Parameter Substitution: parameter "CorrelationParameter_1" =  "20000"
Action.c(250): Downloading resource "http://bpa.baidu.com/bpa/bpa.js" (specified by argument number 23)      [MsgId: MMSG-26577]
Action.c(250): Downloading resource "http://www.moojnn.com/mojingcsp/public/page/list" (specified by argument number 26)      [MsgId: MMSG-26577]
Action.c(250): Downloading resource "http://www.moojnn.com/mojingcsp/public/feedback/types" (specified by argument number 29)      [MsgId: MMSG-26577]
Action.c(250): Downloading resource "http://www.moojnn.com/mojingcsp/public/scrollinfo/promotion" (specified by argument number 32)      [MsgId: MMSG-26577]
Action.c(250): web_submit_data("lxb.gif_2") was successful, 10566 body bytes, 1258 header bytes, 69 chunking overhead bytes      [MsgId: MMSG-26385]
Action.c(270): web_add_cookie was successful      [MsgId: MMSG-26392]
Action.c(272): Notify: Parameter Substitution: parameter "CorrelationParameter_1" =  "20000"
Action.c(272): Notify: Parameter Substitution: parameter "CorrelationParameter_1" =  "20000"
Action.c(272): Downloading resource "http://www.moojnn.com/mojingcsp/public/page/4/videos/top4?O_o=bd457w0xdnt" (specified by argument number 9)      [MsgId: MMSG-26577]
Action.c(272): Downloading resource "http://hm.baidu.com/hm.gif?cc=0&ck=1&cl=24-bit&ds=1366x768&ep=%7B%22netAll%22%3A4%2C%22netDns%22%3A18%2C%22netTcp%22%3A0%2C%22srv%22%3A4%2C%22dom%22%3A2858%2C%22loadEvent%22%3A62312%2C%22qid%22%3A%22%22%2C%22bdDom%22%3A0%2C%22bdRun%22%3A0%2C%22bdDef%22%3A0%7D&et=87&fl=22.0&ja=0&ln=zh-CN&lo=0&lt=1467473654&nv=0&rnd=970334483&si=177ebef2f9a9244c738b903eef680a83&st=4&su=http%3A%2F%2Fwww.moojnn.com%2Fuser%2Flogin.html&v=1.1.26&lv=3" (specified by argument number 12)      [MsgId: MMSG-26577]
Action.c(272): web_url("bpaId_2") was successful, 1086 body bytes, 556 header bytes, 12 chunking overhead bytes      [MsgId: MMSG-26385]
Ending action Action.
Ending iteration 1.
Starting iteration 2.
Notify: Next row for parameter userName = 2 [table  = userName].
Notify: Getting new value for parameter userName: table = userName.dat column = 0 row = 2.
Starting action Action.
Action.c(4): web_add_cookie was successful      [MsgId: MMSG-26392]

 以下是引用别人的文章

Loadrunner日志设置与查看

1.打开EXtended Log
   Log告诉了我们一切,默认的Log是standard Log,这时远远不够的.我们要extended log,打开路径为runtime settings-->log-->extended log.把parameter substitution和data returned byserver和advanced trace大家根据需要勾选吧.
  2.log文件位置,特别是controll执行后,怎么看log。这里一一说明一下:
   (1)vgen的runtime settings设置:在vgen中,我们必须写输出函数输出信息,将我们所想要了解的信息用函数输出,主要有这么几个函数输出信 息:lr_output_message,lr_error_message,lr_log_message。这些函数请参阅 help-->function reference.
   其次,我们要在runtime settings中设置,勾选always send messages,具体的做法是:runtime settings--->log-->always send messages,这样我们才能写出Log,在我们的脚本所在的文件夹中,有两个文件很重要,mdrv.log.txt和output.txt文 件,lr_log_message只会把信息输到mdrv.log文件中,而lr_output_message则会写进以上两个文件。
  (2)controller的runtime settings设置:在controller我们也要设置runtime settings,这样才能在场景运行后查看相应日志, 而且每个用户组的runtime settings都有设置。设置的方法是:在controller的design标签页中,右下角的部分有runtime settings按钮,我们点击它,设置的方法与在vgen中一样的。很多朋友都会想知道多次迭代,参数是否正确的导入了呢,我们依旧查看log,我们在 执行结束后,查看结果目录的Log文件夹,如果是负载生成器运行的话,则在tmp目录。
  Windows环境下,日志文件output.txt保存在脚本目录中;在UNIX环境下,保存在标准输出中。
【Vuser】——【Run Time Settings】——【General】——【Log】
1、【Enable logging】启动日志功能;(建议运行场景进行负载测试时关闭此项)
2、【Send messages only when an error occurs】仅发送出错时的日志,可设置缓存大小(默认1KB);
3、【Always send message】发送所有日志;
4、【Standard log】标准日志,脚本运行时发送函数信息;
【Extended log】扩展日志:
5、【Parameter substitution】脚本运行时,在【Replay log】显示参数信息、参数值;
6、【Data returned by server】记录服务器返回的所有数据;
7、【Advanced trace】多用于脚本调试,记录VU在运行期间发送的所有函数信息。
  ========================================
  【Replay log】显示的日志颜色:
  1、红色:错误信息;
  2、橙色:迭代信息;
  3、蓝色:事件信息;
  4、黑色:输出信息;
  5、绿色:字符信息。
  ========================================
  输出函数:
1、lr_log_message()    // 输出信息,并记录到 output.txt 中
2、lr_output_message()    // 输出信息,不记录到日志文件中
3、lr_message()    // 输出信息,不记录到日志文件中
4、lr_error_message()    // 输出信息,不记录到日志文件中

loadrunner 日志中 输入参数化的值

标签:

原文地址:http://www.cnblogs.com/amy7758/p/5638925.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!