1. Parameter Properties
Parameter type
2. create table > edit with notepad
Add Columns
Add Rows
3. select





要替换某个值,需要将这个Original value变为该值
Parameter type |
描述 |
Custom |
普通常规参数替换 |
Date/Time |
日期/时间型参数,可以指定不同格式时间 |
File |
文本型,读取.bat文件中的内容,内容可以在下面表格中编辑,可以多列,用逗号分隔 |
GroupName |
用户所属于组(跑脚本时) |
Iteration Number |
迭代编号参数替换vuser的迭代编号 |
Load Generator Name |
控制器名称 |
Random Number |
随机数字,需要设置最大最小值,常用于一定范围内取值,或vuser执行任务的百分比分布 |
Table |
与file文本相同 |
Unique Number |
唯一值 |
User Defined Function |
用户自定义函数 |
VuserID |
用户id |
xml |
用于xml结构中包含的多值数据,在这个结构中,一个数组可以成为另一个数组的一部分。常用在xml服务或soap服务 |
Select next row |
Sequential
|
顺序 |
按照参数化顺序,从上往下 |
Random |
随机 |
从参数化数据中,随机取值 |
Unique |
唯一 |
为每个虚拟用户分配一个唯一数据 |
Update value on |
Each iteration |
每次迭代 |
每次迭代取新的值 |
Each occurrence |
每次出现 |
每次参数取值都取新的值 |
once |
一次 |
一条数据只被取一次 |









情况一:Abort Vuser:停止测试


情况二:Continue in a cyclic manner:循环取值,再重新开始新一轮的unique取值


情况三:Continue with last value:沿用最后一个值







没有明显的事务标识
一般,一个取样器就算一个事务
可以显示添加事务开始和结束标识
开始、结束事务之间请求数无限制
1. atoi() 字符串转为整型
2. atof() 字符串转为浮点型
3. itoa() 整型转为字符型
4. asctime() 字符串形式显示时间
5. ctime() 时间转换为本地时间
6. strcmp() 比较两个变量
7. strcpy() 复制字符串
8. strcat() 连接两个字符串
1. abs 获取数字绝对值
2. cos 余弦
3. sin 正弦
4. fopen 打开文件
5. fclose 关闭文件
6. fread 读取文件
7. fwrite 写文件
8. fscanf 格式化输入
9. fprintf 格式化输出
10. ftime 打印时间
11. gmtime 转为UTC时间
12. strftime 时间转为字符串输出
13. stricmp 不区分大小写比较
14. strlen 字符串长度
15. strlwr 字符串转为小写
16. strupr 字符串转为大写
1. commandline函数
lr_get_atrrib_string();
2. database函数
lr_db_connect();
lr_db_disconnect();
lr_db_executeSQLStement();
lr_db_getValue();
3. infomation函数
lr_whoami();
4. Message函数
lr_error_message();
lr_message();
lr_log_message();
lr_output_message(); (与lr_log_message()的区别是,不仅会在面板展示,还会写到文件中去)
5. run-time函数
lr_abort();
lr_continue_on_error();
lr_exit();
lr_rendezvous();
lr_think_time();
6. 字符参数函数
lr_eval_string();
lr_paramarr_len();
lr_save_datetime();
lr_save_param_regexp();
lr_save_string();
7. 事务函数
lr_start_transaction();
lr_stop_transaction();
8. xml函数
1. 动作函数
web_custom_request(); 可以用作get和post
web_submit_data();
web_submit_form();
web_url();
2. 认证函数
3. 异步函数
4. 检查函数
web_find();
web_reg_find();
5. 连接函数
6. 并发组函数
7. cookie相关函数
web_add_cookie();
web_cleanup_cookie();
web_remove_cookie();
8. 相关函数
web_reg_save_param_ex();
web_reg_save_param_regexp();
web_set_max_html_param_len();
9. 数据格式函数
10. 过滤函数
11. header函数
web_add_auto_header();
web_add_header();
web_cleanup_auto_headers();
web_remove_auto_header();
web_save_header();
12. 代理服务器函数
13. 重播函数
web_set_option();
web_set_timeout();
运行结果
Virtual User Script started at : 2019/11/9 15:26:52
Starting action vuser_init.
Web Turbo Replay of LoadRunner 12.0.0 for Windows 2008 R2; build 2739 (Nov 30 2014 23:13:05) [MsgId: MMSG-27143]
Run mode: HTML [MsgId: MMSG-26993]
Run-Time Settings file: "C:\Users\beck\Documents\VuGen\Scripts\WebHttpHtml8\\default.cfg" [MsgId: MMSG-27141]
Ending action vuser_init.
Running Vuser...
Starting iteration 1.
Maximum number of concurrent connections per server: 6 [MsgId: MMSG-26989]
Starting action Action.
Action.c(5): Notify: Saving Parameter "host = 192.168.0.102".
Action.c(6): Notify: Saving Parameter "port = 8081".
Action.c(8): Notify: Saving Parameter "pwd = 123456".
Action.c(12): web_reg_save_param started [MsgId: MMSG-26355]
Action.c(12): Registering web_reg_save_param was successful [MsgId: MMSG-26390]
Action.c(22): web_url("register") started [MsgId: MMSG-26355]
Action.c(22): Notify: Parameter Substitution: parameter "host" = "192.168.0.102"
Action.c(22): Notify: Parameter Substitution: parameter "port" = "8081"
Action.c(22): Notify: Parameter Substitution: parameter "randomPhone" = "77753678"
Action.c(22): Notify: Parameter Substitution: parameter "pwd" = "123456"
Action.c(22): t=1414ms: 157-byte response headers for "http://192.168.0.102:8081/futureloan/mvc/api/member/register?mobilephone=13877753678&pwd=123456" (RelFrameId=1, Internal ID=1)
Action.c(22): HTTP/1.1 200 OK\r\n
Action.c(22): Server: Apache-Coyote/1.1\r\n
Action.c(22): Content-Type: application/json;charset=UTF-8\r\n
Action.c(22): Transfer-Encoding: chunked\r\n
Action.c(22): Date: Sat, 09 Nov 2019 07:26:52 GMT\r\n
Action.c(22): \r\n
Action.c(22): t=1422ms: 4-byte chunked response overhead for "http://192.168.0.102:8081/futureloan/mvc/api/member/register?mobilephone=13877753678&pwd=123456" (RelFrameId=1, Internal ID=1)
Action.c(22): 3c\r\n
Action.c(22): t=1422ms: 7-byte chunked response overhead for "http://192.168.0.102:8081/futureloan/mvc/api/member/register?mobilephone=13877753678&pwd=123456" (RelFrameId=1, Internal ID=1)
Action.c(22): \r\n
Action.c(22): 0\r\n
Action.c(22): \r\n
Action.c(22): t=1426ms: 60-byte chunked response body for "http://192.168.0.102:8081/futureloan/mvc/api/member/register?mobilephone=13877753678&pwd=123456" (RelFrameId=1, Internal ID=1)
Action.c(22): {"status":1,"code":"10001","data":null,"msg":"娉ㄥ唽鎴愬姛"}
Action.c(22): Notify: Saving Parameter "register_response_1 = "status":1,"code":"10001","data":null,"msg":"娉ㄥ唽鎴愬姛"".
Action.c(22): HTML parsing not performed for Content-Type "application/json" ("ParseHtmlContentType" Run-Time Setting is "TEXT"). URL="http://192.168.0.102:8081/futureloan/mvc/api/member/register?mobilephone=13877753678&pwd=123456" [MsgId: MMSG-26548]
Action.c(22): Notify: Saving Parameter "register_response_count = 1".
Action.c(22): web_url("register") was successful, 60 body bytes, 157 header bytes, 11 chunking overhead bytes [MsgId: MMSG-26385]
Action.c(28): Notify: Parameter Substitution: parameter "register_response_count" = "1"
Action.c(28): Notify: Parameter Substitution: parameter "register_response_1" = ""status":1,"code":"10001","data":null,"msg":"娉ㄥ唽鎴愬姛""
Action.c(28): Notify: Saving Parameter "register_result = "status":1,"code":"10001","data":null,"msg":"注册成功"\x00".
Action.c(35): web_reg_save_param started [MsgId: MMSG-26355]
Action.c(35): Registering web_reg_save_param was successful [MsgId: MMSG-26390]
Action.c(44): web_reg_find started [MsgId: MMSG-26355]
Action.c(44): Registering web_reg_find was successful [MsgId: MMSG-26390]
Action.c(50): web_url("login") started [MsgId: MMSG-26355]
Action.c(50): Notify: Parameter Substitution: parameter "host" = "192.168.0.102"
Action.c(50): Notify: Parameter Substitution: parameter "port" = "8081"
Action.c(50): Notify: Parameter Substitution: parameter "pwd" = "123456"
Action.c(50): t=1575ms: 157-byte response headers for "http://192.168.0.102:8081/futureloan/mvc/api/member/login?mobilephone=13845968970&pwd=123456" (RelFrameId=1, Internal ID=2)
Action.c(50): HTTP/1.1 200 OK\r\n
Action.c(50): Server: Apache-Coyote/1.1\r\n
Action.c(50): Content-Type: application/json;charset=UTF-8\r\n
Action.c(50): Transfer-Encoding: chunked\r\n
Action.c(50): Date: Sat, 09 Nov 2019 07:26:52 GMT\r\n
Action.c(50): \r\n
Action.c(50): t=1581ms: 4-byte chunked response overhead for "http://192.168.0.102:8081/futureloan/mvc/api/member/login?mobilephone=13845968970&pwd=123456" (RelFrameId=1, Internal ID=2)
Action.c(50): 3c\r\n
Action.c(50): t=1582ms: 7-byte chunked response overhead for "http://192.168.0.102:8081/futureloan/mvc/api/member/login?mobilephone=13845968970&pwd=123456" (RelFrameId=1, Internal ID=2)
Action.c(50): \r\n
Action.c(50): 0\r\n
Action.c(50): \r\n
Action.c(50): t=1582ms: 60-byte chunked response body for "http://192.168.0.102:8081/futureloan/mvc/api/member/login?mobilephone=13845968970&pwd=123456" (RelFrameId=1, Internal ID=2)
Action.c(50): {"status":1,"code":"10001","data":null,"msg":"鐧诲綍鎴愬姛"}
Action.c(50): Notify: Saving Parameter "login_response_1 = "status":1,"code":"10001","data":null,"msg":"鐧诲綍鎴愬姛"".
Action.c(50): HTML parsing not performed for Content-Type "application/json" ("ParseHtmlContentType" Run-Time Setting is "TEXT"). URL="http://192.168.0.102:8081/futureloan/mvc/api/member/login?mobilephone=13845968970&pwd=123456" [MsgId: MMSG-26548]
Action.c(50): Notify: Saving Parameter "login_response_count = 1".
Action.c(50): Registered web_reg_find successful for "Text=10001" (count=1) [MsgId: MMSG-26364]
Action.c(50): Notify: Saving Parameter "login_status = 1".
Action.c(50): web_url("login") was successful, 60 body bytes, 157 header bytes, 11 chunking overhead bytes [MsgId: MMSG-26385]
Action.c(56): Notify: Parameter Substitution: parameter "login_response_count" = "1"
Action.c(56): Notify: Parameter Substitution: parameter "login_response_1" = ""status":1,"code":"10001","data":null,"msg":"鐧诲綍鎴愬姛""
Action.c(56): Notify: Saving Parameter "login_result = "status":1,"code":"10001","data":null,"msg":"登录成功"\x00".
Action.c(60): Notify: Parameter Substitution: parameter "login_status" = "1"
Action.c(61): ************登录成功*****************
Ending action Action.
Ending iteration 1.
Ending Vuser...
Starting action vuser_end.
Ending action vuser_end.
Vuser Terminated.
1. 函数的书写格式 "url=http://{host}:{port}/futureloan/mvc/api/member/register?mobilephone={mobilephone}&pwd={pwd}", 而不是下面这样,还有要注意,如果这里是虚拟机,而服务部署在本机,host应该是本机的ip,而不是127.0.0.1

2. log设置,按F4,找到Log,勾选Extended log

3. 另外一个查函数的方法





__EOF__
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?