Performance test study notes (20201114)

====== Function ======

>Function
Tools >Function Assistant

  • _Random() random function ----- random numbers, including the left and right boundaries, will repeat
  • _RandomString() random string
  • _counter() counter function +1 every time
  • _digest() encryption function (MD5)
  • _intSum() integer sum
  • _P()、
  • _property() Get property function

          Properties: static properties, dynamic properties

          Static properties: fixed in the file .properties

          Dynamic attributes: dynamically generated during jmeter running, and automatically end attributes after closing jmeter ====== label,

  • _setProperty() is a function to set properties and generate dynamic properties, you can define the property name and value by yourself

            Attributes can be passed directly across thread groups

Variable: It is required for the running of its own script, and is also an external additional definition

Local variable: Can not directly cross thread group, but I set it as an attribute dynamically, it can cross thread group

====Realization: local variables, set as dynamic properties of jmeter with _setProperty(), and then use _P(), _property(), you can use it directly

Attributes: user attributes, system attributes

  • _threadNum gets the number of threads
  • _time() Get current time function

              >  s{_time(yyy-MM-dd HH.mm:ss:SSs,)}

  • timeShift() time shift

             > ${_timeShift(yyy-MM-dd HH.mm:ss:sss,,p2dt4h6m10.234s,,)}

  • _RandomData() random date

             > ${_RandomDate(yyyyMMdd,20201018,20201028,,)}

  • _dateTimeCovert() timestamp to local time

             >   ${_dateTimeConvert(1599723255000,,yyyyMMdd HHmmss,)}

  • _v() splicing function       

Jmeter not only lacks java support, but also supports groovy. jyfhon three kinds-performance script, no beanshell component-jsr223

groovy=====Variant of java language, as long as you understand java, you can write most of groovy

jython-----combination of java+python, python writes py+java grammar m--jython
java is a compiled language. When executed, it is compiled and then executed. When compiled, it produces class binary bytes Code file: ===== When executing, efficiency comparison

Python is an interpreted language, translating one line, executing one line, the efficiency is lower than java

Jython, the writing method is simpler than java, using the python writing method, compiling the language, when executing the class file, and then executing it, the efficiency is higher than python, and the efficiency is basically the same as java.

ngrinder=====This tool can directly generate groovy scripts and jython scripts, which can directly record scripts
 

json extractor: post processor,

1. Post processor priority: after the sampler, the priority is definitely lower than the sampler

2. When you determine that the response is in json format, the json extractor is preferred (json extractor can only extract json), if the response is not json, you cannot use json extractor

Use json first, a json extractor is the fastest, most efficient, and simplest

json extractive writing:

Absolute path: $. Primary node. Secondary node

Relative path: $..node name====value

In the json extractor, to write multiple extraction formulas to the relevant json extractor, you must write the default value, and the number of default values ​​must be the same as the number of extraction formulas

 

 

 


 

 

Guess you like

Origin blog.csdn.net/mbrs_311723/article/details/110058063
Recommended