|
各位大大,小弟压测时遇到一个问题,lr_save_string后无法用lr_eval_string取出参数的值,请问该如何才能取出参数{ParamTest1}的值,并打印在日志中。
脚本如下:
Action()
{
lr_start_transaction("Test");
lr_think_time(2);
lr_save_string("hello world","{ParamTest1}");
lr_log_message("~~~~~~~~~~~~~ Begin ~~~~~~~~~~~~~");
lr_log_message("The value of {ParamTest1} is: %s ! ",lr_eval_string("{ParamTest1}"));
lr_log_message("~~~~~~~~~~~~~ End ~~~~~~~~~~~~~");
lr_end_transaction("Test",LR_AUTO);
return 0;
}
运行结果如下:
Starting action Action. [MsgId: MMSG-15919]
Action.c(12): Notify: Transaction "Test" started. [MsgId: MMSG-16999]
Action.c(13): lr_think_time: 2.00 seconds. [MsgId: MMSG-15948]
Action.c(14): Notify: Saving Parameter "{ParamTest1} = hello world". [MsgId: MMSG-13798]
~~~~~~~~~~~~~ Begin ~~~~~~~~~~~~~ [MsgId: MMSG-17999]
The value of {ParamTest1} is: {ParamTest1} ! [MsgId: MMSG-17999]
~~~~~~~~~~~~~ End ~~~~~~~~~~~~~ [MsgId: MMSG-17999]
Action.c(18): Notify: Transaction "Test" ended with "Pass" status (Duration: 2.0004 Think Time: 1.9997). [MsgId: MMSG-16872]
Ending action Action. [MsgId: MMSG-15918]
Ending iteration 1. [MsgId: MMSG-15965]
Starting iteration 2. [MsgId: MMSG-15968]
Notify: Next row for parameter ParamTest = 2 [table = ParamTest]. [MsgId: MMSG-13876]
Notify: Getting new value for parameter 'ParamTest': table = 'ParamTest.dat' column = '0' row = '2'. [MsgId: MMSG-13877]
Notify: Next row for parameter ParamTest1 = 1 [table = ParamTest1]. [MsgId: MMSG-13876]
Notify: Getting new value for parameter 'ParamTest1': table = 'ParamTest1.dat' column = '0' row = '1'. [MsgId: MMSG-13877]
Starting action Action. [MsgId: MMSG-15919]
Action.c(12): Notify: Transaction "Test" started. [MsgId: MMSG-16999]
Action.c(13): lr_think_time: 2.00 seconds. [MsgId: MMSG-15948]
Action.c(14): Notify: Saving Parameter "{ParamTest1} = hello world". [MsgId: MMSG-13798]
~~~~~~~~~~~~~ Begin ~~~~~~~~~~~~~ [MsgId: MMSG-17999]
The value of {ParamTest1} is: {ParamTest1} ! [MsgId: MMSG-17999]
~~~~~~~~~~~~~ End ~~~~~~~~~~~~~ [MsgId: MMSG-17999]
Action.c(18): Notify: Transaction "Test" ended with "Pass" status (Duration: 2.0009 Think Time: 2.0006). [MsgId: MMSG-16872]
|
|