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的取值设置有 ...
随机推荐
- db2一、查询
1.查询单条数据( fetch 放在最后) select * from x where 1=1 order by id fetch first 1 rows only
- 深入理解MVC原理
SpringMVC的工作原理图: SpringMVC流程 1. 用户发送请求至前端控制器DispatcherServlet. 2. DispatcherServlet收到请求调用HandlerMa ...
- nginx----------前端写了一套带有vue路由的的功能。放到nginx配置的目录下以后,刷新会报404未找到。
1. 这是根据实际情况来写的. location /h5/activity/wechat/ { index index.html index.htm index.php; ...
- tree状数据叶子节点与根节点等的递归转换
做项目时经常遇到树状层级数据.从各个层级数据的转换查询等.场景如行业类别的多层级,行政区层级,检查项类别层级等等. 数据结构如 Id Name ParentId #region area树状节点的转 ...
- sql查询语句如何执行
MySQL 可以分为 Server 层和存储引擎层两部分. 查询缓存: Mysql拿到一个查询请求之后,会先查询缓存,之前执行过的语句及结果可能会以Key-Value的形式被存在缓存中,Key是查询语 ...
- 在java中使用Mysql数据库,如何在MyBatis的xml里面处理时间为Int类型的数据
主要是将显示在页面上的数据变成日期格式,而不是相应的毫秒数,具体的做法如下: 1.首先需要在相关的xml文件里面修改时间为下面语句,其中reg_time为要修改的日期列名 FROM_UNIXTIME( ...
- linux执行jmeter脚本解决响应数据为空
Linux服务器用命令执行了jmeter脚本,在本地查看结果时发现结果树种的“请求.响应数据”都显示为空,有错误日志中也看不出所以然,请看演示! 1 ,先执行脚本:执行成功(...end of run ...
- ltp-ddt git
ltp-ddt目录下有一个文件夹 confrVOaeL confvp5WrA 这个文件夹是由./configure --host=arm-linux-gnueabihf命令生成的. 每次configu ...
- 【题解】Luogu P4396 [AHOI2013]作业
原题传送门 最快的解法好像是cdq,但窝只会莫队+线段树/树状数组的做法 题目要我们求1.在区间[l,r]中值域在[a,b]中有多少个数2.在区间[l,r]中值域在[a,b]中有多少个不同数 一眼就看 ...
- [c/c++] programming之路(30)、位运算(一)
一.取反 ~ #include<stdio.h> #include<stdlib.h> void main(){ unsigned ; //0000 1111 char的单位是 ...