• loadRunner之参数化


    测试脚本:
    Action()
    {
        int i=0;
     
        //循环10次 ,输出变量的值
        for(i;i<=10;i++){
            lr_output_message("%s",lr_eval_string("{parameterized}"));
        }
     
        return 0;
    }
    参数列表个数为5:
     
     
    参数化配置之如何取值(select next row):
     
    1、select next row:Sequential(按顺序选择下一行,当递归到最后一个参数后,从第一个参数开始重新递归)
    代码执行结果:
    Starting iteration 1.
    Starting action Action.
    Action.c(7): Value1
    Action.c(7): Value2
    Action.c(7): Value3
    Action.c(7): Value4
    Action.c(7): Value5
    Action.c(7): Value1
    Action.c(7): Value2
    Action.c(7): Value3
    Action.c(7): Value4
    Action.c(7): Value5
    Ending action Action.
    Ending iteration 1.
     
    2、select next row:Random(随机值,从参数列表中随机选取值)
    代码执行结果:
    Starting iteration 1.
    Starting action Action.
    Action.c(7): Value1
    Action.c(7): Value1
    Action.c(7): Value3
    Action.c(7): Value5
    Action.c(7): Value3
    Action.c(7): Value1
    Action.c(7): Value3
    Action.c(7): Value4
    Action.c(7): Value5
    Action.c(7): Value3
    Ending action Action.
    Ending iteration 1.

    3、select next row:Unique(唯一值,按顺序选择下一行,当递归到最后一个参数后,LoadRunner直接报错)
    代码执行结果:
    Starting iteration 1.
    Starting action Action.
    Action.c(7): Value1
    Action.c(7): Value2
    Action.c(7): Value3
    Action.c(7): Value4
    Action.c(7): Value5
    Action.c(7): Error: Parameter 'parameterized': No more unique values for this parameter in table 'parameterized.dat' [unique range is 1-5].The parameter continues with last value of the range according to "When Out Of Values" policy.
    Action.c(7): Value5
    Action.c(7): Error: Parameter 'parameterized': No more unique values for this parameter in table 'parameterized.dat' [unique range is 1-5].The parameter continues with last value of the range according to "When Out Of Values" policy.
    Action.c(7): Value5
    Action.c(7): Error: Parameter 'parameterized': No more unique values for this parameter in table 'parameterized.dat' [unique range is 1-5].The parameter continues with last value of the range according to "When Out Of Values" policy.
    Action.c(7): Value5
    Action.c(7): Error: Parameter 'parameterized': No more unique values for this parameter in table 'parameterized.dat' [unique range is 1-5].The parameter continues with last value of the range according to "When Out Of Values" policy.
    Action.c(7): Value5
    Action.c(7): Error: Parameter 'parameterized': No more unique values for this parameter in table 'parameterized.dat' [unique range is 1-5].The parameter continues with last value of the range according to "When Out Of Values" policy.
    Action.c(7): Value5
    Ending action Action.
    Ending iteration 1
     
     
    参数化配置之何时取值(update value on):
     
    1、update value on:each iteration(每次迭代的时候取值,在同一个迭代中,无论读多少次,获得的都是同一个参数值)
    代码执行结果:
    Starting iteration 1.
    Starting action Action.
    Action.c(7): Value1
    Action.c(7): Value1
    Action.c(7): Value1
    Action.c(7): Value1
    Action.c(7): Value1
    Action.c(7): Value1
    Action.c(7): Value1
    Action.c(7): Value1
    Action.c(7): Value1
    Action.c(7): Value1
    Ending action Action.
    Ending iteration 1.
    Starting iteration 2.
    Starting action Action.
    Action.c(7): Value2
    Action.c(7): Value2
    Action.c(7): Value2
    Action.c(7): Value2
    Action.c(7): Value2
    Action.c(7): Value2
    Action.c(7): Value2
    Action.c(7): Value2
    Action.c(7): Value2
    Action.c(7): Value2
    Ending action Action.
    Ending iteration 2.
     
    2、update value on:each occurrence(只要取一次,就要新的)
    代码执行结果:
    Starting iteration 1.
    Starting action Action.
    Action.c(7): Value1
    Action.c(7): Value2
    Action.c(7): Value3
    Action.c(7): Value4
    Action.c(7): Value5
    Action.c(7): Value1
    Action.c(7): Value2
    Action.c(7): Value3
    Action.c(7): Value4
    Action.c(7): Value5
    Ending action Action.
    Ending iteration 1.
    Starting iteration 2.
    Starting action Action.
    Action.c(7): Value1
    Action.c(7): Value2
    Action.c(7): Value3
    Action.c(7): Value4
    Action.c(7): Value5
    Action.c(7): Value1
    Action.c(7): Value2
    Action.c(7): Value3
    Action.c(7): Value4
    Action.c(7): Value5
    Ending action Action.
    Ending iteration 2.
     
    3、update value on:once(在所有循环中都使用同一个值)
    代码执行结果:
    Starting iteration 1.
    Starting action Action.
    Action.c(7): Value1
    Action.c(7): Value1
    Action.c(7): Value1
    Action.c(7): Value1
    Action.c(7): Value1
    Action.c(7): Value1
    Action.c(7): Value1
    Action.c(7): Value1
    Action.c(7): Value1
    Action.c(7): Value1
    Ending action Action.
    Ending iteration 1.
    Starting iteration 2.
    Starting action Action.
    Action.c(7): Value1
    Action.c(7): Value1
    Action.c(7): Value1
    Action.c(7): Value1
    Action.c(7): Value1
    Action.c(7): Value1
    Action.c(7): Value1
    Action.c(7): Value1
    Action.c(7): Value1
    Action.c(7): Value1
    Ending action Action.
    Ending iteration 2.
  • 相关阅读:
    Access小用之感
    PHP学习之路今日开启
    IBatis初体验2
    PHP之PDO介绍
    javascript key code 大全
    如何将虚拟机中的Linux系统与shell终端连接
    linux磁盘情况查询
    vi和vim编辑器的使用
    Linux磁盘分区,挂载
    (转)Android Dalvik虚拟机初识
  • 原文地址:https://www.cnblogs.com/yuan-yuan/p/4503581.html
Copyright © 2020-2023  润新知