JMeter ----内置函数列表
Jmeter有两种类型的函数:
用户定义的静态值(或变量)
内置函数
用户定义的静态值允许用户定义变量时被替换为静态的值测试树编译并提交运行。需要注意的是,变量目前无法嵌套,即${Var${N}}不起作用
__ V(变量)函数(版本2.2后)可用于执行此操作: ${__V(Var${N})}. 这种类型的替换可能没有函数,但更方便,更直观
函数和变量可以在哪里使用?
函数和变量可以被写入到任何领域的任何测试部件。
下面的函数测试计划应确定工作:
intSum
longSum
machineName
BeanShell
javaScript
jexl
random
time
property functions
log functions
测试计划使用的功能有一些限制。JMeter的线程变量没有被完全成立处理功能时,不会设置变量名作为参数传递,将无法正常工作和变量引用,所以split() 和 regex() 变量赋值函数不会工作。 threadNum() 函数将不能工作
引用变量及函数
引用的变量中的测试元件是通过包围在变量名 '${' and '}'.
函数中引用同样的方式,但按照惯例,函数的名称以“__”开头,以避免冲突与用户值的名称
有些函数带参数的配置,而这些括号中,逗号分隔。如果函数没有参数,括号可以省略。对于例如:
${__BeanShell(vars.put("name","value"))} 另外,可以定义你的脚本作为一个变量,例如测试计划:
SCRIPT vars.put("name","value")
然后,该脚本可以被引用如下:
${__BeanShell(${SCRIPT})}
预定义变量
JMeter 内部定义的一些变量。它们分别是:
COOKIE_cookiename - 包含cookie的值
JMeterThread.last_sample_ok - 与否的最后一个样本是确定的 - true/false。注:这是更新后的后处理和断言已经运行。
START 变量
预先定义的特性
一些内置的的属性定义JMeter。下面列出了这些。为方便起见,启动的属性也被复制到具有相同名称的变量。
START.MS - JMeter 启动时间(毫秒)
START.YMD - JMeter 启动时间为 yyyyMMdd
START.HMS - JMeter 启动时间为 HHmmss
TESTSTART.MS - 测试开始时间(毫秒)
请注意,开始变量/属性代表 JMeter 的启动时间,而不是测试开始时间。它们主要适用于使用文件名等。
表11-1 JMeter内置函数列表
函数类型 | 名称 | 注释 |
---|---|---|
Information | threadNum | get thread number |
Information | samplerName | get the sampler name (label) |
Information | machineIP | get the local machine IP address |
Information | machineName | get the local machine name |
Information | time | return current time in various formats |
Information | log | log (or display) a message (and return the value) |
Information | logn | log (or display) a message (empty return value) |
Input | StringFromFile | read a line from a file |
Input | FileToString | read an entire file |
Input | CSVRead | read from CSV delimited file |
Input | XPath | Use an XPath expression to read from a file |
Calculation | counter | generate an incrementing number |
Calculation | intSum | add int numbers |
Calculation | longSum | add long numbers |
Calculation | Random | generate a random number |
Calculation | RandomString | generate a random string |
Calculation | UUID | generate a random type 4 UUID |
Scripting | BeanShell | run a BeanShell script |
Scripting | javaScript | process JavaScript (Mozilla Rhino) |
Scripting | jexl, jexl2 | evaluate a Commons Jexl expression |
Properties | property | read a property |
Properties | P | read a property (shorthand method) |
Properties | setProperty | set a JMeter property |
Variables | split | Split a string into variables |
Variables | V | evaluate a variable name |
Variables | eval | evaluate a variable expression |
Variables | evalVar | evaluate an expression stored in a variable |
String | regexFunction | parse previous response using a regular expression |
String | escapeOroRegexpChars | quote meta chars used by ORO regular expression |
String | char | generate Unicode char values from a list of numbers |
String | unescape | Process strings containing Java escapes (e.g. & ) |
String | unescapeHtml | Decode HTML-encoded strings |
String | escapeHtml | Encode strings using HTML encoding |
String | TestPlanName | Return name of current test plan |
JMeter ----内置函数列表的更多相关文章
- 查看python 3中的内置函数列表,以及函数功能描述
>>> dir(__builtins__)//查看内置函数(BIF)列表 ['ArithmeticError', 'AssertionError', 'AttributeError' ...
- Python内置函数列表
函数 用途 abs() 返回数字绝对值 all() 判断给定的可迭代参数 iterable 中的所有元素是否都为 TRUE,如果是返回 True,否则返回 False any() 判断给定的可迭代参数 ...
- python常用类型的内置函数列表
1.list.append(obj) 向列表中加入一个对象obj fruits = ['apple', 'pear', 'orange'] >>> fruits.ap ...
- awk 内置函数列表
1.gsub要在整个记录中替换一个字符串为另一个,使用正则表达式格式,/目标模式/,替换模式/.例如改变学生序号4842到4899:$ awk 'gsub('4842/, 4899) {print $ ...
- [Python笔记]第四篇:内置函数
本篇主要内容:内置函数 函数 参考:https://docs.python.org/3.5/library/functions.html 内置函数列表 一.数学运算类 abs(x)求绝对值 >& ...
- (MariaDB)MySQL内置函数大全
html { font-family: sans-serif } body { margin: 0 } article,aside,details,figcaption,figure,footer,h ...
- Python第七天 函数 函数参数 函数里的变量 函数返回值 多类型传值 函数递归调用 匿名函数 内置函数
Python第七天 函数 函数参数 函数里的变量 函数返回值 多类型传值 函数递归调用 匿名函数 内置函数 目录 Pycharm使用技巧(转载) Python第一天 ...
- PYTHON语言之常用内置函数
一 写在开头本文列举了一些常用的python内置函数.完整详细的python内置函数列表请参见python文档的Built-in Functions章节. 二 python常用内置函数请注意,有关内置 ...
- MySQL--(了解)可能会用到的内置函数
mysql内置函数列表可以从mysql官方文档查询,这里仅分类简单介绍一些可能会用到的函数.1 数学函数abs(x)pi()mod(x,y)sqrt(x)ceil(x)或者ceiling(x)rand ...
随机推荐
- 求两个数中的较大值max(a,b)。(不用if,>)
题目:求两个数的较大值,不能使用if.>. 1.不使用if.>,还要比较大小,貌似就只能使用条件表达式: x=<表达式1>?<表达式2>:<表达式3>; ...
- 性能二 fortnite unreal opt
https://replay.unrealsummit.co.kr/data2018/usm2018_42.pdf?ckattempt=1 https://www.unrealengine.com/e ...
- Candy leetcode java
题目: There are N children standing in a line. Each child is assigned a rating value. You are giving c ...
- CentOS 7 开放防火墙端口命令
CentOS 7 开放防火墙端口 命令 最近公司新的server要求用CentOS7, 发现以前CentOS 6 系列中的 iptables 相关命令不能用了,查了下,发现Centos 7使用fire ...
- jQuery EasyUI 教程-Tooltip(提示框)
<!DOCTYPE html> <html> <head> <title>jQuery Easy UI</title> <meta c ...
- Back Track 5 之 Web踩点 && 网络漏洞
Web踩点 CMS程序版本探测 Blindelephant 针对WORDPRESS程序的踩点工具,通过比较插件等一系列的指纹,判断版本. 格式: Python Blindelephant.py [参数 ...
- idea 本地调用zookeeper配置
- windows、linux mysql部署
阅读目录: 1.Windows下安装MySQL 2.Linux下安装MySQL 序章: MySQL是个小型的数据库,用来自己做小项目,做学习练习什么的再适合不过了,不过新手总会被一些莫名奇妙的问题难住 ...
- IE11下javascript报堆栈溢出问题的解决
在IE11浏览器下,使用日期函数里面的toLocaleDateString()会报堆栈溢出 不知道是不是跟我的其他相关代码有关,还是就是这个toLocaleDateString()在IE11确实不太一 ...
- UVA 624 CD(DP + 01背包)
CD You have a long drive by car ahead. You have a tape recorder, but unfortunately your best music i ...