Re: Combining Counter and While Controller
On 20 March 2012 04:59, Pulkit Singhal wrote: > FYI conversion is done like so in the BSF PreProcessor (child of While > Controller) using javascript language: > vars.put( "upcTotal", props.get("upcTotal") ); If the upcTotal property is set to its final value before the thread group starts, you should be able to hoist the BSF preprocessor out of the loop. You could use User Parameters instead: Name: upcTotal User_1: upcTotal Provided that you use a setupThread to set the properties, they will be available before the main thread groups start, and you can use the Config element User Defined Variables instead to copy the properties to variables. If you use an ordinary threadGroup then UDV will run before the property is set. But the __P() function call should work in the same places as variable evaluation - ${VAR} - so this should not be necessary. > On Mon, Mar 19, 2012 at 11:58 PM, Pulkit Singhal > wrote: > >> Worked around the problem by adding a BSF PreProcessor as a child of the >> While Controller in order to convert the JMeter Property into a JMeter >> variable. >> >> So instead of: >> >> ${__javaScript(${upcCounter}<=${__P(upcTotal)})} >> >> I now use: >> ${__javaScript(${upcCounter}<=${upcTotal})} >> >> But still that's a rather contrived workaround. >> >> Can anyone answer why: JMeter Properties not evaluate-able in logic >> controllers? >> >> >> On Mon, Mar 19, 2012 at 11:19 PM, Pulkit Singhal >> wrote: >> >>> Changing the condition from: >>> >>> >>> ${__javaScript(${upcCounter}<=${__P(upcTotal)})} >>> >>> to something like: >>> >>> ${__javaScript(${upcCounter}<=10)} >>> >>> helps narrow down the problem to the following chunk of code: >>> >>> ${__P(upcTotal)} >>> >>> So are JMeter Properties not evaluate-able in logic controllers? >>> >>> >>> On Mon, Mar 19, 2012 at 12:10 PM, Pulkit Singhal >> > wrote: >>> 1) The data that I need to access is present in JMeterProperties (comes from a different thread group - consecutive excution): upcArray_1 = 012934023423 ... upcArray_10 = 342034234233 Therefore the foreach controller does not work for me as it tries to find the prefix (upcArray) in the JMeterVariables which is not the right place to look for it. 2) So I am attempting to add a counter as the child of the while controller to let me loop through the data in the JMeterProperties: WHILE CONTROLLER Condition: ${__javaScript(${upcCounter}<=${__P(upcTotal)})} CHILD COUNTER Start: 1 Increment: 1 Reference Name: upcCounter Track Counter Independently for each user - YES 3) But it counts 1 then 2 and then its stops! It doesn't go all the way up to 10 ... what am I doing wrong here? >>> >>> >> - To unsubscribe, e-mail: user-unsubscr...@jmeter.apache.org For additional commands, e-mail: user-h...@jmeter.apache.org
Re: Combining Counter and While Controller
On 20 March 2012 04:19, Pulkit Singhal wrote: > Changing the condition from: > > ${__javaScript(${upcCounter}<=${__P(upcTotal)})} > > to something like: > > ${__javaScript(${upcCounter}<=10)} > > helps narrow down the problem to the following chunk of code: > > ${__P(upcTotal)} > > So are JMeter Properties not evaluate-able in logic controllers? It's a function call (that happens to read a property), such calls are valid wherever a variable reference is valid. > On Mon, Mar 19, 2012 at 12:10 PM, Pulkit Singhal > wrote: > >> 1) The data that I need to access is present in JMeterProperties (comes >> from a different thread group - consecutive excution): >> >> upcArray_1 = 012934023423 >> ... >> upcArray_10 = 342034234233 >> >> Therefore the foreach controller does not work for me as it tries to find >> the prefix (upcArray) in the JMeterVariables which is not the right place >> to look for it. >> >> 2) So I am attempting to add a counter as the child of the while >> controller to let me loop through the data in the JMeterProperties: >> >> WHILE CONTROLLER >> Condition: ${__javaScript(${upcCounter}<=${__P(upcTotal)})} >> >> CHILD COUNTER >> Start: 1 >> Increment: 1 >> Reference Name: upcCounter >> Track Counter Independently for each user - YES >> >> 3) But it counts 1 then 2 and then its stops! It doesn't go all the way up >> to 10 ... what am I doing wrong here? >> - To unsubscribe, e-mail: user-unsubscr...@jmeter.apache.org For additional commands, e-mail: user-h...@jmeter.apache.org
Re: Combining Counter and While Controller
FYI conversion is done like so in the BSF PreProcessor (child of While Controller) using javascript language: vars.put( "upcTotal", props.get("upcTotal") ); On Mon, Mar 19, 2012 at 11:58 PM, Pulkit Singhal wrote: > Worked around the problem by adding a BSF PreProcessor as a child of the > While Controller in order to convert the JMeter Property into a JMeter > variable. > > So instead of: > > ${__javaScript(${upcCounter}<=${__P(upcTotal)})} > > I now use: > ${__javaScript(${upcCounter}<=${upcTotal})} > > But still that's a rather contrived workaround. > > Can anyone answer why: JMeter Properties not evaluate-able in logic > controllers? > > > On Mon, Mar 19, 2012 at 11:19 PM, Pulkit Singhal > wrote: > >> Changing the condition from: >> >> >> ${__javaScript(${upcCounter}<=${__P(upcTotal)})} >> >> to something like: >> >> ${__javaScript(${upcCounter}<=10)} >> >> helps narrow down the problem to the following chunk of code: >> >> ${__P(upcTotal)} >> >> So are JMeter Properties not evaluate-able in logic controllers? >> >> >> On Mon, Mar 19, 2012 at 12:10 PM, Pulkit Singhal > > wrote: >> >>> 1) The data that I need to access is present in JMeterProperties (comes >>> from a different thread group - consecutive excution): >>> >>> upcArray_1 = 012934023423 >>> ... >>> upcArray_10 = 342034234233 >>> >>> Therefore the foreach controller does not work for me as it tries to >>> find the prefix (upcArray) in the JMeterVariables which is not the right >>> place to look for it. >>> >>> 2) So I am attempting to add a counter as the child of the while >>> controller to let me loop through the data in the JMeterProperties: >>> >>> WHILE CONTROLLER >>> Condition: ${__javaScript(${upcCounter}<=${__P(upcTotal)})} >>> >>> CHILD COUNTER >>> Start: 1 >>> Increment: 1 >>> Reference Name: upcCounter >>> Track Counter Independently for each user - YES >>> >>> 3) But it counts 1 then 2 and then its stops! It doesn't go all the way >>> up to 10 ... what am I doing wrong here? >>> >> >> >
Re: Combining Counter and While Controller
Worked around the problem by adding a BSF PreProcessor as a child of the While Controller in order to convert the JMeter Property into a JMeter variable. So instead of: ${__javaScript(${upcCounter}<=${__P(upcTotal)})} I now use: ${__javaScript(${upcCounter}<=${upcTotal})} But still that's a rather contrived workaround. Can anyone answer why: JMeter Properties not evaluate-able in logic controllers? On Mon, Mar 19, 2012 at 11:19 PM, Pulkit Singhal wrote: > Changing the condition from: > > > ${__javaScript(${upcCounter}<=${__P(upcTotal)})} > > to something like: > > ${__javaScript(${upcCounter}<=10)} > > helps narrow down the problem to the following chunk of code: > > ${__P(upcTotal)} > > So are JMeter Properties not evaluate-able in logic controllers? > > > On Mon, Mar 19, 2012 at 12:10 PM, Pulkit Singhal > wrote: > >> 1) The data that I need to access is present in JMeterProperties (comes >> from a different thread group - consecutive excution): >> >> upcArray_1 = 012934023423 >> ... >> upcArray_10 = 342034234233 >> >> Therefore the foreach controller does not work for me as it tries to find >> the prefix (upcArray) in the JMeterVariables which is not the right place >> to look for it. >> >> 2) So I am attempting to add a counter as the child of the while >> controller to let me loop through the data in the JMeterProperties: >> >> WHILE CONTROLLER >> Condition: ${__javaScript(${upcCounter}<=${__P(upcTotal)})} >> >> CHILD COUNTER >> Start: 1 >> Increment: 1 >> Reference Name: upcCounter >> Track Counter Independently for each user - YES >> >> 3) But it counts 1 then 2 and then its stops! It doesn't go all the way >> up to 10 ... what am I doing wrong here? >> > >
Re: Combining Counter and While Controller
Changing the condition from: ${__javaScript(${upcCounter}<=${__P(upcTotal)})} to something like: ${__javaScript(${upcCounter}<=10)} helps narrow down the problem to the following chunk of code: ${__P(upcTotal)} So are JMeter Properties not evaluate-able in logic controllers? On Mon, Mar 19, 2012 at 12:10 PM, Pulkit Singhal wrote: > 1) The data that I need to access is present in JMeterProperties (comes > from a different thread group - consecutive excution): > > upcArray_1 = 012934023423 > ... > upcArray_10 = 342034234233 > > Therefore the foreach controller does not work for me as it tries to find > the prefix (upcArray) in the JMeterVariables which is not the right place > to look for it. > > 2) So I am attempting to add a counter as the child of the while > controller to let me loop through the data in the JMeterProperties: > > WHILE CONTROLLER > Condition: ${__javaScript(${upcCounter}<=${__P(upcTotal)})} > > CHILD COUNTER > Start: 1 > Increment: 1 > Reference Name: upcCounter > Track Counter Independently for each user - YES > > 3) But it counts 1 then 2 and then its stops! It doesn't go all the way up > to 10 ... what am I doing wrong here? >
Combining Counter and While Controller
1) The data that I need to access is present in JMeterProperties (comes from a different thread group - consecutive excution): upcArray_1 = 012934023423 ... upcArray_10 = 342034234233 Therefore the foreach controller does not work for me as it tries to find the prefix (upcArray) in the JMeterVariables which is not the right place to look for it. 2) So I am attempting to add a counter as the child of the while controller to let me loop through the data in the JMeterProperties: WHILE CONTROLLER Condition: ${__javaScript(${upcCounter}<=${__P(upcTotal)})} CHILD COUNTER Start: 1 Increment: 1 Reference Name: upcCounter Track Counter Independently for each user - YES 3) But it counts 1 then 2 and then its stops! It doesn't go all the way up to 10 ... what am I doing wrong here?