zoukankan      html  css  js  c++  java
  • 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.
  • 相关阅读:
    angularJS之基础知识(一)
    angularJS之$http:与服务器交互
    angualrJS之表单验证
    python实现命令行中的进度条原理
    通过Arcpy在ArcMap工具箱中添加脚本计算面图层的起终点坐标
    关于ArcGIS API for JavaScript中basemap的总结介绍(一)
    初学JAVA--分支语句
    移动端开发通用适配
    js中Number.toFixed()方法的理解
    <div>标签仿<textarea>。contentEditable=‘true’,赋予非表单标签内容可以编辑
  • 原文地址:https://www.cnblogs.com/yuan-yuan/p/4503581.html
Copyright © 2011-2022 走看看