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 新增的函数 ************** ...
随机推荐
- jquery全选 不全选
<input type="checkbox" id="check">点击 <input type="checkbox" c ...
- 换目标啦,初识PHP
一.初识PHP脚步程序 1.PHP开始标记 <?php 2.PHP结束标记 ?> <?php?> 3.我们的页面最终是通过html,css,js来展示出一个炫丽的界面 4.PH ...
- 虚拟机下hadoop1.1.2安装(单机版)与(集群版)
(1)我的电脑环境 CentOS6.5,64位,在虚拟机下实现. (2)jdk1.6的安装 jdk我用的是1.6.0_27,自己在网上下载jdk-6u27-linux-x64.zip 先在/usr/l ...
- Python+Selenium+PageObject
一.安装page_objects测试库 二.目录介绍 1.pages包:用于各界面元素定位,如BaseLoginPage.py 2.testcases包:用于编写各功能测试用例,如Login.py 3 ...
- 通过Ajax方式上传文件(input file),使用FormData进行Ajax请求
<script type="text/jscript"> $(function () { $("#btn_uploadimg").click(fun ...
- 【mybatis】mybatis中 <if test=>等于的条件怎么写
- Applet学习教程(一):applet+dwr 实现
后台代码 import java.applet.Applet; import java.util.HashMap; import java.util.Map; import netscape.java ...
- !!在js中的用法
var obj = ""; //undefinedconsole.log(!!obj); //false(强制转换成Boolean类型)
- python 使用 PIL 和 matplotlib 获取图片像素点处理之后再写入
python 版本 3.x 首先安装 PIL 由于PIL仅支持到Python 2.7,加上年久失修,于是一群志愿者在PIL的基础上创建了兼容的版本,名字叫Pillow,支持最新Python 3.x,又 ...
- python列表排重:列表排重并计算字符出现的次数
a=[,,,,,,,,,,,] dictc={} for i in range(len(a)): dictc[a[i]]=a.count(a[i]) for key in dictc: print k ...