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 新增的函数 ************** ...
随机推荐
- oracle中的listener.ora和tnsnames.ora
一.oracle的客户端与服务器端 oracle在安装完成后服务器和客户端都需要进行网络配置才能实现网络连接. 服务器端配置监听器,客户端配置网络服务名. 服务器端可配置一个或多个监听程序 . ...
- jQuery效果-----fadeIn()、fadeOut()、fadeToggle()、fadeTo()
fadeIn(),fadeOut(),fadeToggle(),fadeTo() fadeIn()-----淡入已经隐藏的元素(把隐藏的被选元素渐渐显示出来). 语法:$(selector).fade ...
- tool 使用font-spider解决字体压缩问题
开发页面时经常需要使用特殊字体,一个.ttf文件动则几M,字体文件需要优化 http://font-spider.org/ 安装好node环境后 1.全局安装font-spider npm insta ...
- 定位属性position
定位属性position小结 1.元素为fixed(固定的),则是固定定位,即使是子元素,也不参考父元素的位置,即以浏览器作为参考定位.相当于电脑屏幕的一只蚂蚁,你无论怎么滑动屏幕,还是在原来的位置. ...
- python练习题-day22
1.编写程序, 编写一个学生类, 要求有一个计数器的属性, 统计总共实例化了多少个学生 class Student: count=0 def __init__(self,name,age,gender ...
- python 录入姓名和成绩, 并且求平均值
lst = []while 1: a = input("请输入学生的姓名和成绩(姓名_成绩), 输入Q退出录入:") if a.upper() == "Q": ...
- python数组相关知识
1.np中的reshape函数,可以把矩阵重新划分成m行n列. arange(n)可以把 [0,n-1]装入数组中,一定要注意的是img.reshape()并不会改变原来的数组,所以需要另外新建一个数 ...
- Python3.0科学计算学习之函数
函数 函数允许程序的控制在不同的代码片段之间切换,函数的重要意义在于可以在程序中清晰地分离不同的任务,将复杂的问题分解为几个相对简单的子问题,并逐个解决.即"分而治之". Pyth ...
- java Design Patterns
设计模式(Design Patterns) ——可复用面向对象软件的基础 设计模式(Design pattern)是一套被反复使用.多数人知晓的.经过分类编目的.代码设计经验的总结.使用设计模式是为了 ...
- .net如何引用该命名空间
一.在.Net中如何引用该命名空间 (1)System.Windows.Threading 该命名空间在程序集WindowsBase(WindowsBase.dll)下 (2)System.Windo ...