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 新增的函数 ************** ...
随机推荐
- Mac OS Sierra安装源不能设置任何来源(anywhere)
执行命令 sudo spctl --master-disable 此时再打开 System Preferences -> Security&Privacy 即可看到Anywhere
- 使用mysql设计一个全局订单生产计数器
2018年8月10日08:53:50 一般生产订单号的方式 1,使用时期+随机数1+随机数2 缺点,有可能在并发的时候会出现重复,解决办法就是加唯一索引,在插入数据的做查询是否已经被使用 2,使用时间 ...
- XP下ubuntu双系统安装方法
利用u盘将iso刻录 从u盘启动 连续按alt+f2 进入ubuntu试用 打开终端 输入 sudo umount -l /cdrom sudo umount -l /isodevice 然后安装un ...
- 通过使用Web Workers,Web应用程序可以在独立于主线程的后台线程中,运行一个脚本操作。这样做的好处是可以在独立线程中执行费时的处理任务,从而允许主线程(通常是UI线程)不会因此被阻塞/放慢。
Web Workers API - Web API 接口参考 | MDNhttps://developer.mozilla.org/zh-CN/docs/Web/API/Web_Workers_API ...
- 软件工程第二次作业-VSTS单元测试
一.选择开发工具 开发工具选择 Visual studio 2017 社区版,开发语言为C 由于之前已经安装完毕,所以不上传安装过程,主界面如下: 二.练习自动单元测试 使用的测试工具是VSTS,具体 ...
- WSL(Windows Subsystem for Linux)笔记一安装与使用
1.安装linux子系统 很简单直接在启动或关闭windows功能 中选择“适用于linux的windows子系统”,确定安装后重启即可,安装还是比较快的只用了几分钟. 也可以直接使用shell命令行 ...
- java 多线程争抢资源死锁
多线程争抢资源死锁的原理就是,A线程正在持有锁1却想获取锁2,B线程正在持有锁2却要获取锁1 代码如下: public class Main { static ReentrantLock lock1 ...
- HotSpot设计原理与实现:一、初识HotSpot
一.HotSpot内核模块组成和功能框架 1.HotSpot内核模块图 (1)Prims模块: (2)Service模块: (3)Runtime模块: 二.虚拟机生命周期(JVM初始化过程) 1.虚拟 ...
- 小程序 滚动wx.pageScrollTo
API:https://developers.weixin.qq.com/miniprogram/dev/api/wx.pageScrollTo.html wx.pageScrollTo 在小程序的开 ...
- [py]资源搜集
python在线内存图 我会把一些好的py book的资源放到这里 来源: https://piaosanlang.gitbooks.io/spiders/10day/README10.html Le ...