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 新增的函数 ************** ...
随机推荐
- python联系-迭代器
from collections import Iterable from collections import Iterator import time class Classmate(object ...
- mysql 查询 练习题及答案
CREATE DATABASE school;USE school;/*1.创建student表格*//*id为主键 非空 唯一 */CREATE TABLE student (id INT(10) ...
- lcr电桥浅谈
此图告知,现代的lcr电桥使用的都是虚地,阻抗很高. 系统采用的鉴相器比较简单,是检半个正弦基波(RMS有效值积分),可以有效抵御偶次基波. 倒不如直接使用运放电容移相,比较采样法直接采样最高点. 此 ...
- 推送测试,生产环境无法打印log获取deviceToken,可以通过弹窗获取deviceToken
z- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:( ...
- LeetCode 705 Design HashSet 解题报告
题目要求 Design a HashSet without using any built-in hash table libraries. To be specific, your design s ...
- Redis之基本使用
基本介绍 Redis是一种key-value存储形式的非关系型数据库,也是一个强大的内存型存储系统,但是它比传统的Memcached 更灵活,支持更多的数据类型,同时也可以持久化. 支持的数据类型 先 ...
- java 对象的一点小问题
List<A> list = new ArrayList(); A a = new A(); for(int i=0;i<3;i++) { a.setI(i); list.add(A ...
- 取模性质,快速幂,快速乘,gcd和最小公倍数
一.取模运算 取模(取余)运算法则: 1. (a+b)%p=(a%p+b%p)%p; 2.(a-b)%p=(a%p-b%p)%p; 3.(a*b)%p=(a%p * b%p)%p; 4.(a^b)%p ...
- github仓库的初步使用
github是被戏称为男人们的朋友圈,在github里可以很方便的和同伴合作.以下是github初步建立的步骤.(由于我已经安装好了,所有没有插入图片,如果有未降到的问题先自行百度,如果我后续碰到有关 ...
- java学习之静态内部类
/*静态内部类 * 在类内部定义一个静态内部类 * 静态的含义是该内部类可以向其他静态成员一样,不用依赖与外部类的对象.可以直接使用 * 因此该类只能访问外部类的静态成员 * * * * */ cla ...