jmeter的新增函数说明
本文算是对《零成本实现Web性能测试:基于Apache JMeter》中的《详解JMeter函数和变量》进行狗尾续貂哈,因为最近版本的jmeter增加了几个新函数,在原书中没有说明,我在这里翻译一下英文原文。我更推荐大家去jmeter的官网查找函数定义。http://jmeter.apache.org/usermanual/functions.html
|
Type of function |
Name |
Comment |
Since |
|
Information |
__threadNum |
get thread number |
1.X |
|
Information |
__samplerName |
get the sampler name (label) |
2.5 |
|
Information |
__machineIP |
get the local machine IP address |
2.6 |
|
Information |
__machineName |
get the local machine name |
1.X |
|
Information |
__time |
return current time in various formats |
2.2 |
|
Information |
__log |
log (or display) a message (and return the value) |
2.2 |
|
Information |
__logn |
log (or display) a message (empty return value) |
2.2 |
|
Input |
__StringFromFile |
read a line from a file |
1.9 |
|
Input |
__FileToString |
read an entire file |
2.4 |
|
Input |
__CSVRead |
read from CSV delimited file |
1.9 |
|
Input |
__XPath |
Use an XPath expression to read from a file |
2.0.3 |
|
Calculation |
__counter |
generate an incrementing number |
1.X |
|
Calculation |
__intSum |
add int numbers |
1.8.1 |
|
Calculation |
__longSum |
add long numbers |
2.3.2 |
|
Calculation |
__Random |
generate a random number |
1.9 |
|
Calculation |
__RandomString |
generate a random string |
2.6 |
|
Calculation |
__UUID |
generate a random type 4 UUID |
2.9 |
|
Scripting |
__BeanShell |
run a BeanShell script |
1.X |
|
Scripting |
__javaScript |
process JavaScript (Mozilla Rhino) |
1.9 |
|
Scripting |
__jexl, __jexl2 |
evaluate a Commons Jexl expression |
jexl(2.2), jexl2(2.6) |
|
Properties |
__property |
read a property |
2 |
|
Properties |
__P |
read a property (shorthand method) |
2 |
|
Properties |
__setProperty |
set a JMeter property |
2.1 |
|
Variables |
__split |
Split a string into variables |
2.0.2 |
|
Variables |
__V |
evaluate a variable name |
2.3RC3 |
|
Variables |
__eval |
evaluate a variable expression |
2.3.1 |
|
Variables |
__evalVar |
evaluate an expression stored in a variable |
2.3.1 |
|
String |
__regexFunction |
parse previous response using a regular expression |
1.X |
|
String |
__escapeOroRegexpChars |
quote meta chars used by ORO regular expression |
2.9 |
|
String |
__char |
generate Unicode char values from a list of numbers |
2.3.3 |
|
String |
__unescape |
Process strings containing Java escapes (e.g. \n & \t) |
2.3.3 |
|
String |
__unescapeHtml |
Decode HTML-encoded strings |
2.3.3 |
|
String |
__escapeHtml |
Encode strings using HTML encoding |
2.3.3 |
|
String |
__urldecode |
Decode a application/x-www-form-urlencoded string |
2.1 |
|
String |
__urlencode |
Encode a string to a application/x-www-form-urlencoded string |
2.1 |
|
String |
__TestPlanName |
Return name of current test plan |
2.6 |
__samplerName
函数samplerName用来返回当前采样器的名称
|
函数参数 |
描述 |
是否必需 |
|
变量名 |
一个引用名(refName),目的是复用这一函数创建的值。可以使用语法${refName}来引用函数创建的值。 |
否 |
__machineIP
函数machineIP用来返回当前机器的ip地址。它使用Java方法InetAddress.getLocalHost()并将其传递到getHostAddress()
|
函数参数 |
描述 |
是否必需 |
|
变量名 |
一个引用名(refName),目的是复用这一函数创建的值。 |
否 |
__RandomString
函数RandomString用来返回指定长度的随机字符串。
|
函数参数 |
描述 |
是否必需 |
|
长度 |
创建的字符串的长度 |
是 |
|
指定字符 |
用于创建字符串的字符 |
否 |
|
变量名 |
一个引用名(refName),目的是复用这一函数创建的值。可以使用语法${refName}来引用函数创建的值。 |
否 |
__UUID
函数UUID用来返回伪造的随机的标准唯一识别码
__escapeOroRegexpChars
函数escapeOroRegexpChars用于转义正则表达式中的字符,相当于Java的正则表达式引擎中的\Q、\E。
例如[^"].+? 会被转换为\[\^\"\]\.\+\?
|
函数参数 |
描述 |
是否必需 |
|
待转义字符串 |
待转义字符串 |
是 |
|
变量名 |
一个引用名(refName),目的是复用这一函数创建的值。可以使用语法${refName}来引用函数创建的值。 |
否 |
__urldecode
函数urldecode用于解密application/x-www-form-urlencoded这种类型的字符串,注意:使用UTF8编码方案
例如,字符串Word+%22school%22+is+%22%C3%A9cole%22+in+french 会被转换为 Word "school" is "école" in french
使用了java的URLDecoder类
|
函数参数 |
描述 |
是否必需 |
|
待解密的字符串 |
待解密的字符串 |
是 |
__urlencode
函数urlencode用于加密一个字符串成为application/x-www-form-urlencoded类型的字符串
例如,字符串Word "school" is "école" in french 会被转换为 Word+%22school%22+is+%22%C3%A9cole%22+in+french
使用了java的 URLEncoder.类
|
函数参数 |
描述 |
是否必需 |
|
待加密的字符串 |
待加密的字符串 |
是 |
__TestPlanName
函数TestPlanName用于返回当前测试计划的名字
jmeter的新增函数说明的更多相关文章
- JMeter36个内置函数及11个新增函数介绍
JMeter内置了36个函数,这些函数可以通过函数助手进行编辑和测试.了解这些函数,不仅能提高JMeter的使用熟练度,也有助于知晓测试工具或测试框架通用的函数有哪些,在自主设计时,作为参考借鉴. J ...
- jmeter中的函数
1.函数帮助 1.tool-------->function helper dialog 可以查看函数帮助 2.jmeter中的函数 1.函数格式 ${__funcctionname(var ...
- Jmeter(二十五)Jmeter之系统函数
都忘了Jmeter4.0已发布((*^▽^*))具体优化项还没体验,记录一下,传送门:http://jmeter.apache.org/download_jmeter.cgi Jmeter的系统函数已 ...
- Jmeter(五)_函数
JMeter提供了很多函数,如果能够熟练使用,可以为脚本带来很多方便. JMeter函数是一种特殊值,可用于除测试计划外的任何组件. 函数调用的格式如下所示:${__functionName(var1 ...
- JMeter ----内置函数列表
Jmeter有两种类型的函数: 用户定义的静态值(或变量) 内置函数 用户定义的静态值允许用户定义变量时被替换为静态的值测试树编译并提交运行.需要注意的是,变量目前无法嵌套,即${Var${N}}不起 ...
- Jmeter中各种函数
${__functionName(var1,var2,var3)} 无参数时,可以直接写成${__functionName} Tips: 如果参数包含逗号,那么一定要使用 \ 来转义,否则 JMete ...
- python3.5新增函数isclose的使用
前言:python3.5的math模块新增一个isclose函数用来判断两个浮点数的值是否接近或相等,这是由于浮点数的计算总是存在一定的误差.下面谈一下用法: import math print(ma ...
- JMeter 中_time 函数的使用(时间戳、当前时间)
有时在接口测试时,其参数需要为时间戳或者是日期格式的数据.针对此问题,可以使用JMeter自带的_time 函数来解决以上问题 操作步骤: 1.通过函数助手,生成一个_time 函数: 2.如果参数为 ...
- SQL Server 2012/2016/2017 新增函数
/************************************************************** SQL Server 2012 新增的函数 ************** ...
随机推荐
- 一个LinkedBlockingQueue线程安全的例子
一个LinkedBlockingQueue线程安全的例子 package llj.mf.ace; import java.util.ArrayList; import java.util.HashSe ...
- Python3.6 提示 ModuleNotFoundError: No module named '_ssl' 模块问题
国内 163 yum 源挺好用 (中科大的也不错) http://mirrors.163.com/.help/CentOS6-Base-163.repo yum install openssl-dev ...
- Idea使用说明
快捷键 ctrl + alt + b : 查找接口的实现类 ctrl + h : 查找类或接口的继承关系 double shift : 搜索任何地方 ctrl + shift + n : 查找文件 c ...
- Android的SQlite的使用
Android系统集成了一个轻量级的数据库:SQlite.SQlite不像Oracle.MySQl数据库那样需要安装.启动服务器进程,SQLite数据库只是一个文件 实例1:向数据库里插入数据 主界面 ...
- 线性表->链式存储->循环链表
文字描述 循环链表是另一种形式的链式存储结构.它的特点是表中最后一个结点的指针域指向头结点,整个链表形成一个环.由此,从表中任一结点出发均可找到表中其他结点. 示意图 算法分析 插入.删除.查找等同单 ...
- LDAP与实现
LDAP是什么? LDAP是轻量目录访问协议,英文全称是Lightweight Directory Access Protocol,一般都简称为LDAP.它是基于X.500标准的,但是简单多了并且可以 ...
- Python 笔记 v1 - json和字符串互转
字符串转为json对象并取值 >>> 使用了Json包中的loads()方法和dumps()方法 string =" { "status": " ...
- numpy(五)
排序: x=np.array([2,5,6,2,3,5]) np.sort(x) 不改变原数组 x.sort() 改变原数组 i=np.argsort(x) 返回排序好的索引值 x[i] 使用花哨索 ...
- vue 通过自定义指令实现 置顶操作;
项目需求:要求当前项目每个页面滑到超出一屏的距离时,出现 backTop 按钮,点击则回到最顶端:俗称置顶操作: 因为涉及到的页面较多,每个页面都加肯定显得重复累赘,最终想到了 Vue 的自定义指令 ...
- js篇-数组合并其中属性值相同的项目且属性值相加
项目背景是:var a = [{id:1,num:"12"},{id:2,num:"13"},{id:3,num:"3"},{id:2,nu ...