|
3#
楼主 |
发表于 2017-7-10 11:31:25
|
只看该作者
我试了下lr_save_string("hello word","ParamTest1")的情况下, lr_eval_string("ParamTest1") 跟 lr_eval_string("{ParamTest1}") 都取不到 hello word,而还是取的参数名 ParamTest1跟{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 iteration 1. [MsgId: MMSG-15968]
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(15): 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(20): Notify: Transaction "Test" ended with "Pass" status (Duration: 2.0036 Think Time: 2.0029). [MsgId: MMSG-16872]
Ending action Action. [MsgId: MMSG-15918]
Ending iteration 1. [MsgId: MMSG-15965]
情形二
脚本如下:
Action()
{
lr_start_transaction("Test");
lr_think_time(2); //lr_save_string("hello world","{ParamTest1}");
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 iteration 1. [MsgId: MMSG-15968]
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(15): 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(20): Notify: Transaction "Test" ended with "Pass" status (Duration: 2.0142 Think Time: 2.0133). [MsgId: MMSG-16872]
Ending action Action. [MsgId: MMSG-15918]
Ending iteration 1. [MsgId: MMSG-15965] |
|