loadrunner 参数化取值方式详解
参数化对话框中与参数取值方式有关的区域如下:

改变参数化的取值方式,关键在于Select next row和Update value on这两个选项。
Select next row包括以下选项:
- Sequential:顺序方式
- Random:随机方式
- Unique:唯一方式
Update value on包括如下选项:
- Each iteration:每次迭代更新取值
- Each occurrence:每次取值更新
- Once:只更新一次
以下代码以登录接口和参数化进行演示,参数化文件中有2个值
lr_output_message("login_username:%s",lr_eval_string("{login_username}"));
web_custom_request("login",
"URL=http://192.168.44.130:8080/mobile/api/user/login",
"Method=POST",
"TargetFrame=",
"Resource=0",
"Referer=",
"Mode=HTTP",
"EncType=application/json;charset=utf-8",
"Body={\"mobile\":\"{login_username}\",\"password\":\"123456\"}",
LAST);
参数化文件中的数据为:
13141140058
第一种取值方式:Sequential+Each iteration,设置迭代次数为3次,参数取值结果为:
Starting iteration 1.
Maximum number of concurrent connections per server: 6 [MsgId: MMSG-26989]
Starting action Action.
Action.c(18): Notify: Parameter Substitution: parameter "login_username" = "13141140050"
Action.c(18): login_username:13141140050
Action.c(20): web_custom_request("login") started [MsgId: MMSG-26355]
Action.c(20): Notify: Parameter Substitution: parameter "login_username" = "13141140050"
Action.c(20): web_custom_request("login") was successful, 361 body bytes, 157 header bytes, 12 chunking overhead bytes [MsgId: MMSG-26385]
Ending action Action.
Ending iteration 1.
Starting iteration 2.
Notify: Next row for parameter login_username = 2 [table = login_username].
Notify: Getting new value for parameter 'login_username': table = 'login_username.dat' column = '0' row = '2'.
Starting action Action.
Action.c(18): Notify: Parameter Substitution: parameter "login_username" = "13141140058"
Action.c(18): login_username:13141140058
Action.c(20): web_custom_request("login") started [MsgId: MMSG-26355]
Action.c(20): Notify: Parameter Substitution: parameter "login_username" = "13141140058"
Action.c(20): web_custom_request("login") was successful, 361 body bytes, 157 header bytes, 12 chunking overhead bytes [MsgId: MMSG-26385]
Ending action Action.
Ending iteration 2.
Starting iteration 3.
Notify: Next row for parameter login_username = 1 [table = login_username].
Notify: Getting new value for parameter 'login_username': table = 'login_username.dat' column = '0' row = '1'.
Starting action Action.
Action.c(18): Notify: Parameter Substitution: parameter "login_username" = "13141140050"
Action.c(18): login_username:13141140050
Action.c(20): web_custom_request("login") started [MsgId: MMSG-26355]
Action.c(20): Notify: Parameter Substitution: parameter "login_username" = "13141140050"
Action.c(20): web_custom_request("login") was successful, 361 body bytes, 157 header bytes, 12 chunking overhead bytes [MsgId: MMSG-26385]
Ending action Action.
Ending iteration 3.
第二种取值方式:Sequential+Each occurrence,设置迭代次数为3次,参数取值结果为:
Starting iteration .
Maximum number of concurrent connections per server: [MsgId: MMSG-]
Starting action Action.
Action.c(): Notify: Getting new value for parameter 'login_username': table = 'login_username.dat' column = '' row = ''.
Action.c(18): Notify: Parameter Substitution: parameter "login_username" = "13141140050"
Action.c(18): login_username:13141140050
Action.c(): web_custom_request("login") started [MsgId: MMSG-]
Action.c(): Notify: Next row for parameter login_username = [table = login_username].
Action.c(): Notify: Getting new value for parameter 'login_username': table = 'login_username.dat' column = '' row = ''.
Action.c(20): Notify: Parameter Substitution: parameter "login_username" = "13141140058"
Action.c(): web_custom_request("login") was successful, body bytes, header bytes, chunking overhead bytes [MsgId: MMSG-]
Ending action Action.
Ending iteration .
Starting iteration .
Starting action Action.
Action.c(): Notify: Next row for parameter login_username = [table = login_username].
Action.c(): Notify: Getting new value for parameter 'login_username': table = 'login_username.dat' column = '' row = ''.
Action.c(18): Notify: Parameter Substitution: parameter "login_username" = "13141140050"
Action.c(18): login_username:13141140050
Action.c(): web_custom_request("login") started [MsgId: MMSG-]
Action.c(): Notify: Next row for parameter login_username = [table = login_username].
Action.c(): Notify: Getting new value for parameter 'login_username': table = 'login_username.dat' column = '' row = ''.
Action.c(20): Notify: Parameter Substitution: parameter "login_username" = "13141140058"
Action.c(): web_custom_request("login") was successful, body bytes, header bytes, chunking overhead bytes [MsgId: MMSG-]
Ending action Action.
Ending iteration .
Starting iteration .
Starting action Action.
Action.c(): Notify: Next row for parameter login_username = [table = login_username].
Action.c(): Notify: Getting new value for parameter 'login_username': table = 'login_username.dat' column = '' row = ''.
Action.c(18): Notify: Parameter Substitution: parameter "login_username" = "13141140050"
Action.c(18): login_username:13141140050
Action.c(): web_custom_request("login") started [MsgId: MMSG-]
Action.c(): Notify: Next row for parameter login_username = [table = login_username].
Action.c(): Notify: Getting new value for parameter 'login_username': table = 'login_username.dat' column = '' row = ''.
Action.c(20): Notify: Parameter Substitution: parameter "login_username" = "13141140058"
Action.c(): web_custom_request("login") was successful, body bytes, header bytes, chunking overhead bytes [MsgId: MMSG-]
Ending action Action.
Ending iteration .
第三种取值方式:Sequential+Once,设置迭代次数为3次,参数取值结果为:
Starting iteration .
Maximum number of concurrent connections per server: [MsgId: MMSG-]
Starting action Action.
Action.c(18): Notify: Parameter Substitution: parameter "login_username" = "13141140050"
Action.c(18): login_username:13141140050
Action.c(): web_custom_request("login") started [MsgId: MMSG-]
Action.c(20): Notify: Parameter Substitution: parameter "login_username" = "13141140050"
Action.c(): web_custom_request("login") was successful, body bytes, header bytes, chunking overhead bytes [MsgId: MMSG-]
Ending action Action.
Ending iteration .
Starting iteration .
Starting action Action.
Action.c(18): Notify: Parameter Substitution: parameter "login_username" = "13141140050"
Action.c(18): login_username:13141140050
Action.c(): web_custom_request("login") started [MsgId: MMSG-]
Action.c(20): Notify: Parameter Substitution: parameter "login_username" = "13141140050"
Action.c(): web_custom_request("login") was successful, body bytes, header bytes, chunking overhead bytes [MsgId: MMSG-]
Ending action Action.
Ending iteration .
Starting iteration .
Starting action Action.
Action.c(18): Notify: Parameter Substitution: parameter "login_username" = "13141140050"
Action.c(18): login_username:13141140050
Action.c(): web_custom_request("login") started [MsgId: MMSG-]
Action.c(20): Notify: Parameter Substitution: parameter "login_username" = "13141140050"
Action.c(): web_custom_request("login") was successful, body bytes, header bytes, chunking overhead bytes [MsgId: MMSG-]
Ending action Action.
Ending iteration .
第四种取值方式:Random+Each iteration,设置迭代次数为3次,参数取值结果为:
Starting iteration .
Maximum number of concurrent connections per server: [MsgId: MMSG-]
Starting action Action.
Action.c(18): Notify: Parameter Substitution: parameter "login_username" = "13141140058"
Action.c(18): login_username:13141140058
Action.c(): web_custom_request("login") started [MsgId: MMSG-]
Action.c(20): Notify: Parameter Substitution: parameter "login_username" = "13141140058"
Action.c(): web_custom_request("login") was successful, body bytes, header bytes, chunking overhead bytes [MsgId: MMSG-]
Ending action Action.
Ending iteration .
Starting iteration .
Notify: Next row for parameter login_username = [table = login_username].
Notify: Getting new value for parameter 'login_username': table = 'login_username.dat' column = '' row = ''.
Starting action Action.
Action.c(18): Notify: Parameter Substitution: parameter "login_username" = "13141140050"
Action.c(18): login_username:13141140050
Action.c(): web_custom_request("login") started [MsgId: MMSG-]
Action.c(20): Notify: Parameter Substitution: parameter "login_username" = "13141140050"
Action.c(): web_custom_request("login") was successful, body bytes, header bytes, chunking overhead bytes [MsgId: MMSG-]
Ending action Action.
Ending iteration .
Starting iteration .
Notify: Next row for parameter login_username = [table = login_username].
Notify: Getting new value for parameter 'login_username': table = 'login_username.dat' column = '' row = ''.
Starting action Action.
Action.c(18): Notify: Parameter Substitution: parameter "login_username" = "13141140058"
Action.c(18): login_username:13141140058
Action.c(): web_custom_request("login") started [MsgId: MMSG-]
Action.c(20): Notify: Parameter Substitution: parameter "login_username" = "13141140058"
Action.c(): web_custom_request("login") was successful, body bytes, header bytes, chunking overhead bytes [MsgId: MMSG-]
Ending action Action.
Ending iteration .
第五种取值方式:Random+Each occurrence,设置迭代次数为3次,参数取值结果为:
Starting iteration .
Maximum number of concurrent connections per server: [MsgId: MMSG-]
Starting action Action.
Action.c(): Notify: Getting new value for parameter 'login_username': table = 'login_username.dat' column = '' row = ''.
Action.c(18): Notify: Parameter Substitution: parameter "login_username" = "13141140050"
Action.c(18): login_username:13141140050
Action.c(): web_custom_request("login") started [MsgId: MMSG-]
Action.c(): Notify: Next row for parameter login_username = [table = login_username].
Action.c(): Notify: Getting new value for parameter 'login_username': table = 'login_username.dat' column = '' row = ''.
Action.c(20): Notify: Parameter Substitution: parameter "login_username" = "13141140058"
Action.c(): web_custom_request("login") was successful, body bytes, header bytes, chunking overhead bytes [MsgId: MMSG-]
Ending action Action.
Ending iteration .
Starting iteration .
Starting action Action.
Action.c(): Notify: Next row for parameter login_username = [table = login_username].
Action.c(): Notify: Getting new value for parameter 'login_username': table = 'login_username.dat' column = '' row = ''.
Action.c(18): Notify: Parameter Substitution: parameter "login_username" = "13141140050"
Action.c(18): login_username:13141140050
Action.c(): web_custom_request("login") started [MsgId: MMSG-]
Action.c(): Notify: Next row for parameter login_username = [table = login_username].
Action.c(): Notify: Getting new value for parameter 'login_username': table = 'login_username.dat' column = '' row = ''.
Action.c(20): Notify: Parameter Substitution: parameter "login_username" = "13141140058"
Action.c(): web_custom_request("login") was successful, body bytes, header bytes, chunking overhead bytes [MsgId: MMSG-]
Ending action Action.
Ending iteration .
Starting iteration .
Starting action Action.
Action.c(): Notify: Next row for parameter login_username = [table = login_username].
Action.c(): Notify: Getting new value for parameter 'login_username': table = 'login_username.dat' column = '' row = ''.
Action.c(18): Notify: Parameter Substitution: parameter "login_username" = "13141140050"
Action.c(18): login_username:13141140050
Action.c(): web_custom_request("login") started [MsgId: MMSG-]
Action.c(): Notify: Next row for parameter login_username = [table = login_username].
Action.c(): Notify: Getting new value for parameter 'login_username': table = 'login_username.dat' column = '' row = ''.
Action.c(20): Notify: Parameter Substitution: parameter "login_username" = "13141140058"
Action.c(): web_custom_request("login") was successful, body bytes, header bytes, chunking overhead bytes [MsgId: MMSG-]
Ending action Action.
Ending iteration .
第六种取值方式:Random+Once,设置迭代次数为3次,参数取值结果为:
Starting iteration .
Maximum number of concurrent connections per server: [MsgId: MMSG-]
Starting action Action.
Action.c(18): Notify: Parameter Substitution: parameter "login_username" = "13141140050"
Action.c(18): login_username:13141140050
Action.c(): web_custom_request("login") started [MsgId: MMSG-]
Action.c(20): Notify: Parameter Substitution: parameter "login_username" = "13141140050"
Action.c(): web_custom_request("login") was successful, body bytes, header bytes, chunking overhead bytes [MsgId: MMSG-]
Ending action Action.
Ending iteration .
Starting iteration .
Starting action Action.
Action.c(18): Notify: Parameter Substitution: parameter "login_username" = "13141140050"
Action.c(18): login_username:13141140050
Action.c(): web_custom_request("login") started [MsgId: MMSG-]
Action.c(20): Notify: Parameter Substitution: parameter "login_username" = "13141140050"
Action.c(): web_custom_request("login") was successful, body bytes, header bytes, chunking overhead bytes [MsgId: MMSG-]
Ending action Action.
Ending iteration .
Starting iteration .
Starting action Action.
Action.c(18): Notify: Parameter Substitution: parameter "login_username" = "13141140050"
Action.c(18): login_username:13141140050
Action.c(): web_custom_request("login") started [MsgId: MMSG-]
Action.c(20): Notify: Parameter Substitution: parameter "login_username" = "13141140050"
Action.c(): web_custom_request("login") was successful, body bytes, header bytes, chunking overhead bytes [MsgId: MMSG-]
Ending action Action.
Ending iteration .
第七种取值方式:Unique+Each iteration
这种取值方式,又可以有以下几种设置:

当值不足时,可以选择以下3种方式:
1)、中断虚拟用户
2)、循环取参数中的值,返回到第一行取值
3)、取最后一行值
以下运行结果以Abort Vuser为例执行,其它情况可自行设置运行,设置迭代次数为3次,参数取值结果为:
Starting iteration .
Maximum number of concurrent connections per server: [MsgId: MMSG-]
Starting action Action.
Action.c(18): Notify: Parameter Substitution: parameter "login_username" = "13141140050"
Action.c(18): login_username:13141140050
Action.c(): web_custom_request("login") started [MsgId: MMSG-]
Action.c(20): Notify: Parameter Substitution: parameter "login_username" = "13141140050"
Action.c(): web_custom_request("login") was successful, body bytes, header bytes, chunking overhead bytes [MsgId: MMSG-]
Ending action Action.
Ending iteration .
Starting iteration .
Notify: Next row for parameter login_username = [table = login_username].
Notify: Getting new value for parameter 'login_username': table = 'login_username.dat' column = '' row = ''.
Starting action Action.
Action.c(18): Notify: Parameter Substitution: parameter "login_username" = "13141140058"
Action.c(18): login_username:13141140058
Action.c(): web_custom_request("login") started [MsgId: MMSG-]
Action.c(20): Notify: Parameter Substitution: parameter "login_username" = "13141140058"
Action.c(): web_custom_request("login") was successful, body bytes, header bytes, chunking overhead bytes [MsgId: MMSG-]
Ending action Action.
Ending iteration .
Starting iteration .
Error: Parameter 'login_username': No more unique values for this parameter in table 'login_username.dat' [unique range is 1-2]. The Vuser is aborted according to "When Out Of Values" policy.
Action was aborted.
Ending Vuser...
第八种取值方式:Unique+Each occurrence,参数不够用时,也会报错,设置迭代次数为3次,参数取值结果为:
Starting iteration .
Maximum number of concurrent connections per server: [MsgId: MMSG-]
Starting action Action.
Action.c(): Notify: Getting new value for parameter 'login_username': table = 'login_username.dat' column = '' row = ''.
Action.c(18): Notify: Parameter Substitution: parameter "login_username" = "13141140050"
Action.c(18): login_username:13141140050
Action.c(): web_custom_request("login") started [MsgId: MMSG-]
Action.c(): Notify: Next row for parameter login_username = [table = login_username].
Action.c(): Notify: Getting new value for parameter 'login_username': table = 'login_username.dat' column = '' row = ''.
Action.c(20): Notify: Parameter Substitution: parameter "login_username" = "13141140058"
Action.c(): web_custom_request("login") was successful, body bytes, header bytes, chunking overhead bytes [MsgId: MMSG-]
Ending action Action.
Ending iteration .
Starting iteration .
Starting action Action.
Action.c(18): Error: Parameter 'login_username': No more unique values for this parameter in table 'login_username.dat' [unique range is 1-2]. The Vuser is aborted according to "When Out Of Values" policy.
Abort was called from an action.
Ending Vuser...
第九种取值方式:Unique+Once,参数不够用时,也会报错,设置迭代次数为3次,参数取值结果为:
Starting iteration .
Maximum number of concurrent connections per server: [MsgId: MMSG-]
Starting action Action.
Action.c(18): Notify: Parameter Substitution: parameter "login_username" = "13141140050"
Action.c(18): login_username:13141140050
Action.c(): web_custom_request("login") started [MsgId: MMSG-]
Action.c(20): Notify: Parameter Substitution: parameter "login_username" = "13141140050"
Action.c(): web_custom_request("login") was successful, body bytes, header bytes, chunking overhead bytes [MsgId: MMSG-]
Ending action Action.
Ending iteration .
Starting iteration .
Starting action Action.
Action.c(18): Notify: Parameter Substitution: parameter "login_username" = "13141140050"
Action.c(18): login_username:13141140050
Action.c(): web_custom_request("login") started [MsgId: MMSG-]
Action.c(20): Notify: Parameter Substitution: parameter "login_username" = "13141140050"
Action.c(): web_custom_request("login") was successful, body bytes, header bytes, chunking overhead bytes [MsgId: MMSG-]
Ending action Action.
Ending iteration .
Starting iteration .
Starting action Action.
Action.c(18): Notify: Parameter Substitution: parameter "login_username" = "13141140050"
Action.c(18): login_username:13141140050
Action.c(): web_custom_request("login") started [MsgId: MMSG-]
Action.c(20): Notify: Parameter Substitution: parameter "login_username" = "13141140050"
Action.c(): web_custom_request("login") was successful, body bytes, header bytes, chunking overhead bytes [MsgId: MMSG-]
Ending action Action.
Ending iteration .
总结:

loadrunner 参数化取值方式详解的更多相关文章
- LoadRunner参数化取值与连接数据库
LoadRunner参数化取值与连接数据库 LoadRunner在使用参数化的时候,通常都是需要准备大数据量的,也因此LoadRunner提供两种参数化取值方式,一种是手动编辑,另一种就是通过连接 ...
- Loadrunner中参数化取值方式分析
Loadrunner中参数化取值依赖两个维度: 1.取值顺序分为“顺序”“随机”“唯一”. select next row:Sequential , Random,unique 2.更新值时分为 ...
- cin 对象取值过程详解
突然又空,鉴于对cin对象的去值机制还不是很了解,就探究一番,并且记下来,方便以后复习. #include <iostream> int main(void) { using namesp ...
- mysql数据库TINYINT取值范围详解
分享下mysql中TINYINT的取值范围,很基础的一些内容. 在MySQL的数据类型中,Tinyint的取值范围是:带符号的范围是-128到127.无符号的范围是0到255(见官方<MySQL ...
- JS子父窗口互相取值赋值详解介绍
子窗口赋值到父窗口 代码如下 复制代码 <script>function openWin(str) { window.open(siteurl+"popup/"+ ...
- LoadRunner参数化取值及连接数据库操作步骤
很多情况下,参数添加的数据不是十条二十条,也不是一百两百,对于这种大数量的数据我们可以通过数据库将数据导入: 选中要参数化的内容如下图一所示: 方法一,右键---[Replace with a new ...
- loadrunner脚本中写入脚本输出log到外部文件,分析参数取值方式
loadrunner脚本中写入脚本输出log到外部文件,分析参数取值方式 分类: 心得 loadrunner 我的测试 2012-04-01 12:52 2340人阅读 评论(0) 收藏 举报 脚本l ...
- JSON取值(key是中文或者数字)方式详解
JSON取值(key是中文或者数字)方式详解 先准备一个json对象用于演示 var json = {'name':'zhangsan', '年龄':23, 404:'你可能迷路了'}; 使用JS中w ...
- LoadRunner中,参数化时Unique取值方式的理解
LoadRunner中,参数化时Unique取值方式的理解 2012年10月15日 18:10:36 瑞秋 阅读数:10028 在LoadRunner中进行参数化时,Parameter的取值设置有 ...
随机推荐
- PHP知识点
目录 1. PHP函数前面添加@的作用 2. PHP连接MySQL数据库字符集设置 1. 通过PDO扩展连接MySQL数据库 2. 通过mysql扩展连接 3. php查询数据库出现中文乱码 3. 参 ...
- nginx中的超时设置,请求超时、响应等待超时等
nginx比较强大,可以针对单个域名请求做出单个连接超时的配置. 比如些动态解释和静态解释可以根据业务的需求配置 proxy_connect_timeout :后端服务器连接的超时时间_发起握手等候响 ...
- charles-Andriod 手机手机抓包乱码
然后重启进行进行抓包
- Cocos Creator_继承组件单例
前言 单例,在游戏开发中是比较常用的功能,全局唯一,可以在任何地方直接获取, 省去了方法赋值 或者 属性面板拖动的麻烦. 普通单例_饿汉模式 不管有没调用,一开始就创建单例 1 // Singleto ...
- kafka笔记9(监控)
Kafka提供的所有度量指标都是通过JMX(Java Management Extensions)接口访问 JMX端口查询: zookeeper上获取端口信息 /brokers/ids/<I ...
- go basic
go time and rand: package main import ( "fmt" "math/rand" "time" ) fun ...
- 求方差分析与两样本T检验 区别
方差分析与两样本T检验. 1.首先可以看到方差分析(ANOVA)包含两样本T检验,把两样本T检验作为自己的特例.因为ANOVA可以比较多个总体的均值,当然包含两个总体作为特例.实际上,T的平方就是F统 ...
- SQL中sysname数据类型的含义(转)
sysname SQL Server 实例包括用户定义的名为 sysname 的数据类型.sysname 用于表列.变量以及用于存储对象名的存储过程参数.sysname 的精确定义与标识符规则相关:因 ...
- qemu创建vm和vcpu进入kvm的流程
kvm是一个内核模块,它实现了一个/dev/kvm的字符设备来与用户进行交互,通过调用一系列ioctl函数可以实现qemu和kvm之间的切换. 1.qemu发起KVM_CREATE_VM的ioctl创 ...
- tensorflow学习笔记3:写一个mnist rpc服务
本篇做一个没有实用价值的mnist rpc服务,重点记录我在调试整合tensorflow和opencv时遇到的问题: 准备模型 mnist的基础模型结构就使用tensorflow tutorial给的 ...