Loadrunner中参数化
上一篇 / 下一篇 2017-03-15 11:39:06 / 个人分类:个人总结
前提条件:1.有参数NewParam,其中包含temp1——temp8这8个参数
2.RunLogic设置为9次
执行脚本:
Action()
{
int i;
for(i=0;i<5;i++){
lr_output_message(lr_eval_string("{NewParam}"));
}
lr_output_message(lr_eval_string("{NewParam}"));
return 0;
}
情况一:Sequential顺序取值+Each iteration每次迭代更新
脚本执行结果:
Starting iteration 1.
Starting action Action.
Action.c(5): temp1
Action.c(5): temp1
Action.c(5): temp1
Action.c(5): temp1
Action.c(5): temp1
Action.c(7): temp1
Ending action Action.
Ending iteration 1.
Starting iteration 2.
Starting action Action.
Action.c(5): temp2
Action.c(5): temp2
Action.c(5): temp2
Action.c(5): temp2
Action.c(5): temp2
Action.c(7): temp2
Ending action Action.
Ending iteration 2.
Starting iteration 3.
Starting action Action.
Action.c(5): temp3
Action.c(5): temp3
Action.c(5): temp3
Action.c(5): temp3
Action.c(5): temp3
Action.c(7): temp3
Ending action Action.
Ending iteration 3.
Starting iteration 4.
Starting action Action.
Action.c(5): temp4
Action.c(5): temp4
Action.c(5): temp4
Action.c(5): temp4
Action.c(5): temp4
Action.c(7): temp4
Ending action Action.
Ending iteration 4.
Starting iteration 5.
Starting action Action.
Action.c(5): temp5
Action.c(5): temp5
Action.c(5): temp5
Action.c(5): temp5
Action.c(5): temp5
Action.c(7): temp5
Ending action Action.
Ending iteration 5.
Starting iteration 6.
Starting action Action.
Action.c(5): temp6
Action.c(5): temp6
Action.c(5): temp6
Action.c(5): temp6
Action.c(5): temp6
Action.c(7): temp6
Ending action Action.
Ending iteration 6.
Starting iteration 7.
Starting action Action.
Action.c(5): temp7
Action.c(5): temp7
Action.c(5): temp7
Action.c(5): temp7
Action.c(5): temp7
Action.c(7): temp7
Ending action Action.
Ending iteration 7.
Starting iteration 8.
Starting action Action.
Action.c(5): temp8
Action.c(5): temp8
Action.c(5): temp8
Action.c(5): temp8
Action.c(5): temp8
Action.c(7): temp8
Ending action Action.
Ending iteration 8.
Starting iteration 9.
Starting action Action.
Action.c(5): temp1
Action.c(5): temp1
Action.c(5): temp1
Action.c(5): temp1
Action.c(5): temp1
Action.c(7): temp1
Ending action Action.
Ending iteration 9.
Ending Vuser...
Starting action vuser_end.
Ending action vuser_end.
Vuser Terminated.
情况二:Sequential顺序取值+Each occurrence每次取值更新
脚本执行结果:
Starting iteration 1.
Starting action Action.
Action.c(5): temp1
Action.c(5): temp2
Action.c(5): temp3
Action.c(5): temp4
Action.c(5): temp5
Action.c(7): temp6
Ending action Action.
Ending iteration 1.
Starting iteration 2.
Starting action Action.
Action.c(5): temp7
Action.c(5): temp8
Action.c(5): temp1
Action.c(5): temp2
Action.c(5): temp3
Action.c(7): temp4
Ending action Action.
Ending iteration 2.
Starting iteration 3.
Starting action Action.
Action.c(5): temp5
Action.c(5): temp6
Action.c(5): temp7
Action.c(5): temp8
Action.c(5): temp1
Action.c(7): temp2
Ending action Action.
Ending iteration 3.
Starting iteration 4.
Starting action Action.
Action.c(5): temp3
Action.c(5): temp4
Action.c(5): temp5
Action.c(5): temp6
Action.c(5): temp7
Action.c(7): temp8
Ending action Action.
Ending iteration 4.
Starting iteration 5.
Starting action Action.
Action.c(5): temp1
Action.c(5): temp2
Action.c(5): temp3
Action.c(5): temp4
Action.c(5): temp5
Action.c(7): temp6
Ending action Action.
Ending iteration 5.
Starting iteration 6.
Starting action Action.
Action.c(5): temp7
Action.c(5): temp8
Action.c(5): temp1
Action.c(5): temp2
Action.c(5): temp3
Action.c(7): temp4
Ending action Action.
Ending iteration 6.
Starting iteration 7.
Starting action Action.
Action.c(5): temp5
Action.c(5): temp6
Action.c(5): temp7
Action.c(5): temp8
Action.c(5): temp1
Action.c(7): temp2
Ending action Action.
Ending iteration 7.
Starting iteration 8.
Starting action Action.
Action.c(5): temp3
Action.c(5): temp4
Action.c(5): temp5
Action.c(5): temp6
Action.c(5): temp7
Action.c(7): temp8
Ending action Action.
Ending iteration 8.
Starting iteration 9.
Starting action Action.
Action.c(5): temp1
Action.c(5): temp2
Action.c(5): temp3
Action.c(5): temp4
Action.c(5): temp5
Action.c(7): temp6
Ending action Action.
Ending iteration 9.
Ending Vuser...
Starting action vuser_end.
Ending action vuser_end.
Vuser Terminated.
情况三:Sequential顺序取值+Once只更新一次
脚本执行结果:
tarting iteration 1.
Starting action Action.
Action.c(5): temp1
Action.c(5): temp1
Action.c(5): temp1
Action.c(5): temp1
Action.c(5): temp1
Action.c(7): temp1
Ending action Action.
Ending iteration 1.
Starting iteration 2.
Starting action Action.
Action.c(5): temp1
Action.c(5): temp1
Action.c(5): temp1
Action.c(5): temp1
Action.c(5): temp1
Action.c(7): temp1
Ending action Action.
Ending iteration 2.
Starting iteration 3.
Starting action Action.
Action.c(5): temp1
Action.c(5): temp1
Action.c(5): temp1
Action.c(5): temp1
Action.c(5): temp1
Action.c(7): temp1
Ending action Action.
Ending iteration 3.
Starting iteration 4.
Starting action Action.
Action.c(5): temp1
Action.c(5): temp1
Action.c(5): temp1
Action.c(5): temp1
Action.c(5): temp1
Action.c(7): temp1
Ending action Action.
Ending iteration 4.
Starting iteration 5.
Starting action Action.
Action.c(5): temp1
Action.c(5): temp1
Action.c(5): temp1
Action.c(5): temp1
Action.c(5): temp1
Action.c(7): temp1
Ending action Action.
Ending iteration 5.
Starting iteration 6.
Starting action Action.
Action.c(5): temp1
Action.c(5): temp1
Action.c(5): temp1
Action.c(5): temp1
Action.c(5): temp1
Action.c(7): temp1
Ending action Action.
Ending iteration 6.
Starting iteration 7.
Starting action Action.
Action.c(5): temp1
Action.c(5): temp1
Action.c(5): temp1
Action.c(5): temp1
Action.c(5): temp1
Action.c(7): temp1
Ending action Action.
Ending iteration 7.
Starting iteration 8.
Starting action Action.
Action.c(5): temp1
Action.c(5): temp1
Action.c(5): temp1
Action.c(5): temp1
Action.c(5): temp1
Action.c(7): temp1
Ending action Action.
Ending iteration 8.
Starting iteration 9.
Starting action Action.
Action.c(5): temp1
Action.c(5): temp1
Action.c(5): temp1
Action.c(5): temp1
Action.c(5): temp1
Action.c(7): temp1
Ending action Action.
Ending iteration 9.
Ending Vuser...
Starting action vuser_end.
Ending action vuser_end.
Vuser Terminated.
Sequential取值下的各种情况
Random取值
顺序取值的各种方法搞明白后,Random取值(随机取值)就比较简单了,随机取值可以实现在参数列表中随机选择一条记录,将parameters这个参数的Select next row取值方法从sequential改为Random
Select next row下的Random选项是,参数化的取值情况如下表
选择Select
next row下的Unique选项是,参数化取值情况如下表
TAG: