zoukankan      html  css  js  c++  java
  • 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. & )

    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用于返回当前测试计划的名字

  • 相关阅读:
    Centos7创建CA和申请证书 转自https://www.cnblogs.com/mingzhang/p/8949541.html
    go-micro介绍 摘自https://www.cnblogs.com/s0-0s/p/6874800.html
    docker centos7创建consul镜像以及用docker-compose启动镜像
    今天想用jquery来实现div的拖放功能
    canvas
    子元素的div不继承父元素的透明度
    BOM
    DOM
    JS的循环、复杂运算符
    梳理一下JS的基本语法
  • 原文地址:https://www.cnblogs.com/idbeta/p/5092509.html
Copyright © 2011-2022 走看看