JMeter regex extractor forEach controller

10,607

Solution 1

You have to reference the variable with the function:

${__V(Result_${index}_g1)

Solution 2

...Just for collection.
See also this post for another implementation (case without using ForEach Controller):

ThreadGroup 
    HttpSampler 
        Regex Extractor (variableName = links) 
    WhileController(${__javaScript(${C} < ${links_matchNr})}) 
        HTTPSampler use ${__V(links_${C})} to access the current result 
        Counter (start=1, increment=1, maximum=${links_matchNr}, referenceName=C)
Share:
10,607
rascio
Author by

rascio

about Manuel

Updated on June 07, 2022

Comments

  • rascio
    rascio almost 2 years

    I'm creating some tests with JMeter, the situation is very simple, I have a search page with a list of results, and I have to retrieve from this results some values to use in the next request. Those results are around 350, I don't need them all.

    I used the RegexExtractor to retrieve those results and it works (I setted it to retrieve just 10 results), but now I don't know how to access the results inside a LoopCounter. The extractor put the results into a variable named Result.

    The problem is that I don't know hot to build dinamically the name of a variable. Do I have to use some function like _p()?? I can access the variable just putting the static name Result_0_g1

    Inside the LoopCounter I putted also a Counter to store the loop count into the variable index

    Thank you

    EDIT:

    SOLVED I have to write:

    ${__V(Result_${index}_g1)