The Introduction of Common Functions in Jmeter

来源:互联网 发布:s. 忒修斯之船 知乎 编辑:程序博客网 时间:2024/06/10 14:41

  There are some functions which are provied by JMeter. If you are a green hand to JMeter, I think this page will give you a suprise.

 

  1. _BenShell, you can use the function to do some simple caculation. For example:

     ${__BeanShell(${partS2}+${palletS})}

      partS2 is a variable, and palletS is the variable too. If you use ${partS2}+${palletS} in your test script, this will be taken as a string "${partS2}+${palletS}".

     If you take  ${__BeanShell(${partS2}+${palletS})} as a variable in your test script, this will return the sum of partS2 and palletS.

 

  2. _V, you can take this function to contact the string. For example:

 

       There are some variables: locCode_1,locCode_2, locCode_3, locCode_4.....

       And there is a counter:1,2,3,4,5........

       Now you want to use different locCode in different counter.

       So you should group the locCode and the counter as locCode_counter.

       ${_V(locCode_${counter})}

        when counter is 1, this is equal to ${locCode_1}.