官方文档解释:
The setProperty function sets the value of a JMeter property. The default return value from the function is the empty string, so the function call can be used anywhere functions are valid.
该函数用来给JMeter属性设置值,默认返回值为空字符串,所以在函数在任何地方被调用是有效的
用法:
${__setProperty(property name, property value, True/False)}
property name : 属性名, 必填
property value : 属性值,必填
True/False : 是否返回原始值,非必填,当设置为:true,将返回原始值
作用域:跨线程组调用, 可以在任意地方调用,但不能跟在import xxx 后面
备注:参数不用加双引号引用
一般使用搭配参数化使用,如在线程组中提取参数后,可以使用后置处理器进行使用
查看是否成功,可以通过变量显示,debug sample等;
官方文档解释:The property function returns the value of a JMeter property. If the property value cannot be found, and no default has been supplied, it returns the property name. When supplying a default value, there is no need to provide a function name - the parameter can be set to null, and it will be ignored.
函数返回JMeter的属性值。如果找不到到属性值而且没有提供默认值,将返回属性名。在有提供默认值时,可以选择不用提供引用名(可选的),函数名的值可以设置为null,但会被忽略函数值;
用法:
${__property(property name , variable name, default value)}
porperty name: 要检索的属性名,必填
variable name: 引用名,用于被赋值的变量,非必填
default value:默认值,非必填
${__ property(uuid)} :返回uuid的值
${__property(uuid, aa)} :拿到uuid的值并将uuiduuid赋值给 aa;
${__property(uuid, aa, abc)}: 拿到uuid的值,如果 uuid 未定义即找不到,则把默认值abc的变量值赋值给 aa , aa ,如果默认值未定义则返回默认值的属性名;
${__property(uuid, , abc)}: 返回的是匿名变量名,拿到uuid, 如果默认变量有赋值,则把abc的变量值赋值返回,如果默认值没有定义,则任何默认值的变量名;
${__P}为${__property()}简写,后面补充
总结:
${__setProperty()}与${__property()}一起配合使用,setProptety等于把值拿出来,
property则把setProptety拿出来的值重新赋值
参考:
https://blog.csdn.net/evanzhang_z/article/details/102715619
原文:https://www.cnblogs.com/shoebill/p/14641768.html