JMeter - 捕获所有匹配并将它们写入文件

JMeter - Capture all the Matches and Write them into a file

我有一个包含多个匹配项(准确地说是 17 个)的正则表达式。所有这些都将被捕获并写入文件。

匹配号-1用于捕获所有匹配项

现在,我正在使用 ForEach 控制器迭代这些匹配项。不幸的是,这不起作用。

请帮忙。附上截图供大家参考。

此致, 阿吉特

enter image description here

enter image description here

enter image description here

  1. 在 JMeter GUI 的 top-right 角有一个红色 1 靠近黄色感叹号,这意味着您的测试在某处失败了

    所以检查 jmeter.log file 看看哪里出了问题。

  2. JMeter Post-Processors are only executed in Sampler context, if you put a Post-Processor under the ForEach Controller and there will be no Samplers under that controller - the Post-Processor won't be executed. So I would suggest switching to JSR223 Sampler 代替。

  3. 使用 Groovy 脚本将数据写入文件可能不是最好的主意,因为如果您 运行 使用 >1 个线程(用户)进行测试,您将面临 race condition resulting in data corruption or loss so it might be a better option to consider using Sample Variables and Flexible File Writer