I need to download images concurrently.All the image url's have been extracted from one of the request's response.I used regular expression extractor to capture all the image urls.And ProfileImagePath_matchNr varies.
ProfileImagePath_1="www.mydomain.com/img1.png"
ProfileImagePath_2="www.mydomain.com/img2.png"
ProfileImagePath_3="www.mydomain.com/img3.png"
ProfileImagePath_4="www.mydomain.com/img4.png"
ProfileImagePath_5="www.mydomain.com/img5.png"
ProfileImagePath_6="www.mydomain.com/img6.png"
ProfileImagePath_7="www.mydomain.com/img7.png"
Now I need to download all those images concurrently.I could not able to use jp@gc Parallel http request as the ProfileImagePath_matchNr is varying.
You should be able to construct the list of URLs dynamically like:
Add JSR223 PreProcessor as a child of the
Put the following code into "Script" area:
1.upto(vars.get('ProfileImagePath_matchNr') as int, { index ->
sampler.addURL(vars.get('ProfileImagePath_' + index))
})
That's it, the PreProcessor will retrieve all the images URLs from the JMeter Variables and add them as the targets for the jp@gc - Parallel HTTP Requests
sampler
See Top 8 JMeter Java Classes You Should Be Using with Groovy article to learn what do these vars
and sampler
variables mean