Quantcast

JMeter counter

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

JMeter counter

kitty.tracker
This post has NOT been accepted by the mailing list yet.
I am having trouble using the counter config element. Basically, I need to reset the counter after it leaves the while controller. Thanks.

++Thread
  +HTTP Request
    -Regular Expression Extractor (stored as VARIABLE)
  +While Controller ${__javaScript("${count}" < "${VARIABLE_matchNr}";)}
    -Counter (count)
    -HTTP Request (this will use ${__V(VARIABLE_${count}_g1)} and g2, g3, etc. so that I can use my regex variables)
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: JMeter counter

zillakilla
set the max value of the counter to:
${VARIABLE_matchNr}


zilla
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: JMeter counter

kitty.tracker
This post has NOT been accepted by the mailing list yet.
I tried that before posting, but I couldn't get it to work. It appears that on the second pass through, the count is higher than ${VARIABLE_matchNr} and will not enter the while loop again. I tried a >= on while loop and setting the max value on counter to ${VARIABLE_matchNr} -1 with no luck.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: JMeter counter

zillakilla
Can you change the WHILE controller to a LOOP controller?
then set the Loop Count of the LOOP controller to ${VARIABLE_matchNr}
So your test plan look like this:

++Thread
  +HTTP Request
    -Regular Expression Extractor (stored as VARIABLE)
  +LOOP Controller [Loop count = ${VARIABLE_matchNr}]
    -Counter (count)  [MAX value = ${VARIABLE_matchNr}]
    -HTTP Request (this will use ${__V(VARIABLE_${count}_g1)}

HTH
Zilla
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: JMeter counter

kitty.tracker
This post has NOT been accepted by the mailing list yet.
Interesting concept, but it still doesnt work for me. Count always = 1 while it's in the LOOP controller. So, it keeps pulling the first item on the list over and over such as 1, 1, 1, 1, 1 instead of 1, 2, 3, 4, 5.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: JMeter counter

kitty.tracker
This post has NOT been accepted by the mailing list yet.
it appears that the count variable from the counter is "leaking" between threads. I tried using the "Track counter independly for each user" option ON/OFF with no luck.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: JMeter counter

zillakilla
Try moving the counter so it is BEFORE the loop controller
(i cannot test this as I am not at work, this is from memory)

HTH
zilla
Loading...