Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Looping through multiple Regex extractor output

Tags:

jmeter

Can you please tell me how to loop through the result of a Regex Post Processor that returns multiple values?

Example:

JSON Response message:

{
    "reply": {
        "code": "111",
        "status": "SUCCESS",
        "customerID": [
            "222-a",
            "b-333",
            "44-4",
            "s-555",
            "666",
            "777",
            "88-8"
        ]
    }
} 

Regx extractor helped me extract each individual component of the array:

links_1=222-a
links_2=b-333

I can use some.url/${links_1}.
Here is exactly what I am trying to achieve, but this does not seem to work.
Can you please help me?

Loop through the Regex extracted individual variable using a counter and append each one in another HTTP request sampler:

WhileController(${__javaScript(${C} < ${links_matchNr})}) 
HTTPSampler use ${__V(links_${C})}  
Counter (start=1,increment=1,maximum=${links_matchNr},referenceName=C)
like image 256
Sashi Avatar asked Jun 30 '26 08:06

Sashi


1 Answers

Use ForEach Controller:

  • input variable : links

  • output variable : link for example

enter image description here

You can then use each value inside Controller through:

${link}

like image 189
UBIK LOAD PACK Avatar answered Jul 05 '26 04:07

UBIK LOAD PACK



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!