0
votes

There is a SOAP request which gives total pages in the response and this request needs to be sent as many number of times as of the total pages, keeping page number as a variable. The counter/while controller is not working fine during the load test. The counter stops as soon as it finds a match for one customer. But my requirement is to loop through all the pages for all customers at the same time. Can anyone help?

I.Threadgroup--with 10 threads A.While Controller ${__javaScript(${pagenum} < ${totalpages})} 1.Request i.Regex extractor(totalpages) ii.Counter(pagenum) iii. CSV Data set config(customer) enter image description here

1
What do you mean by "The counter stops as soon as it finds a match for one customer" ?ararar
Let's say customer1 has got 29 pages, so it has to send the requests 29 times with pagenum varying from 1 to 29. Customer2 has got 2 pages, so it should run 2 times, Customer 3 has 16 pages so it should run 16 times and so on. It is running fine for single user. When I run for multiple users, It will run for 2 times and the test stopsI need the customer1 request to run 29 times, customer 2 to run 2 times etc.neethu unofficial

1 Answers

0
votes

Copy the Test_${customer} sampler and paste it just before the while controller, now you have 2 of them, remove the counter from both of them.

Add a BeanShell PostProcessor to the first sampler (which is out of the while controller) and add the below code into the code area:

int Counter = 1;
vars.put("Counter", String.valueOf(Counter));

Now remove the regular expression extractor from the second sampler (which is inside the while controller) and add BeanShell PostProcessor with the below code into the code area:

int Counter = Integer.parseInt(vars.get("Counter"));
Counter = Counter + 1;
vars.put("Counter", String.valueOf(Counter));