How to loop through pages based on the maximum number available using Jmeter

Viewed 103

I'm trying to loop through a GET Request based on the page count.

So I first hit this one endpoint which returns page_count=N(could be 1,2, or 10) and I'm able to extract the number using JSON Extractor and save it as a Variable but I am not sure how do I go about looping through page_count=(based on the total page_count I get from the preceding request).

1 Answers

Just add a Loop Controller and set the number of loops to this page_count variable like

enter image description here

You can refer to the current page number inside the Loop Controller using ${__jm__Loop Controller__idx} pre-defined variable and __intSum() function combination like:

${__intSum(${__jm__Loop Controller__idx},1,)}

Demo:

enter image description here

Related