Customized log for better result analysis
上一篇 /
下一篇 2007-01-05 18:33:33
/ 个人分类:loadrunner
Abstract:Customized log solution described below allows you to write your own data and parameters to log files, export results to an Excel spreadsheet and then analyze them using powerful pivot table or other tools.
We use our custom log function to log data, analyze test results and to get average response times or tps for individual groups, time intervals or parameters – how long it took to display home page for Brasil vs India?
Custom logs also help you in a case when you are not able to use LR Analysis tool to analyze test results.
The idea is to write to regular log files only the data you really want/need. In run-time settings we disable logging and use our custom log function to write to log files.
The sequence in LR scrīpt is:
1.get transaction start time: using LR parameter of type Date/Time: strcpy(cur_time, lr_eval_string("{pTime}"));
2.execute the transaction
3.get:
a.transaction status: rc=lr_get_transaction_status(tr_name);
b.response time: tr_duration = lr_get_transaction_duration(tr_name);
c.message you want to log – usually a parameter used in transaction or transaction results: strcpy(msg, lr_eval_string("{parameter}"));
4.call function STATUS with all these parameters that writes to the log file to:
a.save current log settings: msg_class=lr_get_debug_message();
b.enable logging:: lr_set_debug_message(LR_MSG_CLASS_BRIEF_LOG, LR_MSG_ON );
c.get vuser and group information: lr_whoami(&vuser_id, &group, &sc_id);
d.write all your data to the log file: lr_log_message("Status:, %s, %s, %s, %3.3f ...
e.restore original log level: lr_set_debug_message(msg_class, LR_MSG_ON);
5.After the test combine all log files from log folder to one file using Windows command prompt: find “Status:” *.log >> trans_log.csv
6.open the result log file in Excel and use pivot table or other tools to analyze the data
Attached is the complete scrīpt and scenario.
相关阅读:
- 主题:集合点 (yangjingxiao, 2006-12-22)
- LR中性能计数器的解释详解 (charmer, 2006-12-25)
- 主题:参数化 (yangjingxiao, 2006-12-25)
- Mercury LoadRunner介绍 (Spark.lee, 2006-12-28)
- IP欺骗 (hxxhhl, 2006-12-28)
- VMI出现错误,解决办法二 (pele, 2006-12-30)
- LoadRunner下DLL的调用 (5itesting, 2006-12-30)
- LR 中迭代存在的问题 (charmer, 2006-12-31)
- LR测试的过程中,为什么我们总是连不上服务器 (charmer, 2006-12-31)
- Winsock 与LR(本人翻译) (yangjingxiao, 2007-1-03)
收藏
举报
TAG:
loadrunner