JMeter regex extractor forEach controller

后端 未结 4 477
广开言路
广开言路 2021-01-03 08:08

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

相关标签:
4条回答
  • 2021-01-03 08:44

    Use the ForEach Controller - it's specifically designed for this purpose and does exactly what you want.

    0 讨论(0)
  • You may use ForEach Controller:

    ThreadGroup
        YourSampler
            Regular Expression Extractor (match -1, any template)
        Foreach controller
            Counter(Maximum -> ${Result_matchNr} , Rf Name -> index)
            LinkSamplerUsingParsedData(use -> ${__V(Result_${index}_g1)}
    

    Now, if you want to iterate to all groups, you need another foreach to do that. As you know which group represent what value, you can use this way.

    0 讨论(0)
  • 2021-01-03 08:55

    ...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)
    
    0 讨论(0)
  • 2021-01-03 09:08

    You have to reference the variable with the function:

    ${__V(Result_${index}_g1)
    
    0 讨论(0)
提交回复
热议问题