用于每个控制器的 JMeter 正则表达式提取器 [英] JMeter regex extractor forEach controller
问题描述
我正在使用 JMeter 创建一些测试,情况非常简单,我有一个包含结果列表的搜索页面,我必须从该结果中检索一些值以在下一个请求中使用.这些结果大约是 350,我不需要它们.
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.
我使用 RegexExtractor 来检索这些结果并且它可以工作(我将其设置为仅检索 10 个结果),但现在我不知道如何访问 LoopCounter 中的结果.提取器将结果放入名为 Result 的变量中.
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.
问题是我不知道如何动态地构建变量的名称.我必须使用像_p()这样的函数吗??我可以访问变量只需输入静态名称Result_0_g1
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
在 LoopCounter 中,我还放置了一个 Counter 来将循环计数存储到变量 index
Inside the LoopCounter I putted also a Counter to store the loop count into the variable index
谢谢
解决了我必须写:
${__V(Result_${index}_g1)
${__V(Result_${index}_g1)
推荐答案
你必须用函数来引用变量:
You have to reference the variable with the function:
${__V(Result_${index}_g1)
这篇关于用于每个控制器的 JMeter 正则表达式提取器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!