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的取值设置有 ...
随机推荐
- IDEA使用技巧
1,导入原Eclipse Web项目 由于使用 PowerDesign连接MySql时只能用32位 Jdk,原Eclipse项目依赖于64位Jdk,导致在eclipse打不开工程,把工程导入IDEA后 ...
- 2018-2019-2 网络对抗技术 20165321 Exp6 信息搜集与漏洞扫描
1.实践目标 掌握信息搜集的最基础技能与常用工具的使用方法. 2.实践内容 (1)各种搜索技巧的应用 百度查找IP地址: 查了一下kali的IP地址 https://fofa.so/的使用: 查询了一 ...
- Nuxt 自动化部署及打包后文件自动上传七牛云
1.安装七牛云 2.在项目根目录新建 upload.js 3.上传凭证 4.上传配置,详情参考七牛云文档 5.在 package.js中修改项目build完成执行upload文件命令 7. nuxt. ...
- List、Set、Map集合
1 List接口 我们掌握了Collection接口的使用后,再来看看Collection接口中的子类,他们都具备那些特性呢? 接下来,我们一起学习Collection中的常用几个子类(List集合. ...
- Oracle游标介绍
Oracle游标使用详解: 游标: 用来查询数据库,获取记录集合(结果集)的指针,我们所说的游标通常是指显式游标,因此从现在起没有特别指明的情况,我们所说的游标都是指显式游标.要在程序中使用游标,必须 ...
- 使用Spring的@Async创建异步方法
使用Spring的@Async创建异步方法 在开发系统的过程中,通常会考虑到系统的性能问题,提升系统性能的一个重要思想就是“串行”改“并行”.说起“并行”自然离不开“异步”,今天我们就来聊聊如何使用S ...
- awk if print
awk -F"," '{ if($4=="abc" && $5=="def"){print $1} else {prin ...
- maven clean或package报错
[ERROR] Failed to execute goal on project jeesns-service: Could not resolve dependencies for project ...
- Windbg程序调试系列4-Live Debugging
上篇博文中给大家分享了使用Windbg分析线程阻塞问题: Windbg程序调试系列3-线程阻塞问题 本篇中我们继续,跟大家分享附加进程实时调试-Live Debugging. 先说一下使用Windbg ...
- (转)利用CAS算法实现通用线程安全状态机
在多线程环境下,如果某个类是有状态的,那我们在使用前,需要保证所有该类的实例对象状态一致,否则会出现意向不到的bug.下面是通用线程安全状态机的实现方法. public class ThreadSav ...