apache / jmeter

Apache JMeter open-source load testing tool for analyzing and measuring the performance of a variety of services
https://jmeter.apache.org/
Apache License 2.0
8.19k stars 2.07k forks source link

Jmter的for each控制前的输出变量,在JRS223中无法使用vars.get()方法获得变量 #5483

Closed asfimport closed 3 years ago

asfimport commented 3 years ago

Zames (Bug 65066): 在for each 循环控制器中,遍历后假设输出的变量为A,在http请求中,可以使用${A}的方式获取,但是在JSR223请求当中,使用vars.get(“A”)却获取不到

Severity: normal OS: All Resolution: WORKSFORME

asfimport commented 3 years ago

@FSchumacher (migrated from Bugzilla): Created attachment vars-foreach.jmx: Testplan showing that vars are working

vars-foreach.jmx ````xml false true false IN_1 ONE = IN_2 TWO = continue false 1 1 1 false true IN A true 0 2 true vars.get("A") groovy false saveConfig true true true true true true true false true true false false false true false false false true 0 true true true true true true ````
asfimport commented 3 years ago

@FSchumacher (migrated from Bugzilla): Translation;

""" In the for each loop controller, assume that the output variable is A after traversal. In the http request, you can use ${A} to get it, but in the JSR223 request, use vars.get("A") to get it. To """

This is described in the component reference as a note:

""" JMeter processes function and variable references before passing the script field to the interpreter, so the references will only be resolved once. Variable and function references in script files will be passed verbatim to the interpreter, which is likely to cause a syntax error. In order to use runtime variables, please use the appropriate props methods, e.g.

props.get("START.HMS"); props.put("PROP1","1234"); """

For further discussion on this topic, the mailing list is the right place.