0
votes

I'd like to practice IF controller basically as follow:

TEST_PLAN

+Thread_group: (user: 3, ramp: 3, loop:2)

+Loop_Controller(loop:4)

++ HTTP request1: go to page_1

+IF_Controller1

++ HTTP request2: go to page_2

++ counter (config element)

+IF_Controller2

++ HTTP request3: click Back button

My condition "HTTP request 2" is only executed if loop (output "Loop_Controller" >4). How to do that ? And, for IF_Controller2: it's will be executed after each of question on this page has checked (page has 5 questions, 1 question has 5 answer radio button.)

I also follow the Counter element and Counter functions, but don't know how to combine them?

and one more things: to use the variable in IF statement, they should be put on previous activities ? (in my case: IF controller: ${count}, thereby variable "count" should be put on HTTP request 1)

Thanks,

1
There is already a loop count of 2 in the Thread Group. Then why are you adding a loop counter? And what exactly are you trying to do with the IF condition?msound
Because I think the loop in thread group will loop the request, and Counter(config element) is just a counter to "count". Then, I put this "count" to IF controller (or While Controller) to make condition.Little Chicken
Can you give me a bigger picture of what you are trying to achieve? Or are you just playing around jmeter trying to learn?msound
Because my local web is stopped due to network. Let get others to explain. The page I'm testing is Jmeter. HTTP request_1 is go to Manual if loop > 4.Little Chicken

1 Answers

0
votes

You need to place COUNTER as a child of Loop Controller, not If Controller. In this case you'll get the following scenario:

HTTP Request 1 (loop 1)
HTTP Request 1 (loop 2)
HTTP Request 1 (loop 3)
HTTP Request 1 (loop 4)
** HERE we're getting out of Loop Controller and go to 2nd Loop of Thread Group, If controller doesn't fire as counter value is 4 and condition is >4**
HTTP Request 1 (loop 5)
HTTP Request 1 (loop 6)
HTTP Request 1 (loop 7)
HTTP Request 1 (loop 8)
** HERE counter value is 8 and If controller condition is met so **
HTTP Request 2 

Being child of If Controller counter isn't getting incremented

Counter Configuration:

  • Start: 1
  • Increment: 1
  • Reference Name: N

If Controller Configuration:

${N} > 4

See How to use JMeter's 'IF' Controller and get Pie guide for more details.