JMeter - 动态复制一组组件

JMeter - Replicate a set of Components dynamically

我有一个执行以下操作的 JMeter 脚本(附有屏幕截图):

1. SSH
2. Execute a command
3. Poll the command until the status becomes "Running"
4. Write the Results into a File

enter image description here

enter image description here

enter image description here

我需要一次(并行)为 csv 文件中的所有行复制步骤 1-4。即假设 csv 文件中有 10 行。应对所有行同时执行步骤 1-4。 csv 文件中的行数是动态的。它们会不时变化。

我们将不胜感激您的帮助。感谢您的支持。

此致, 阿吉特

您可以使用 __groovy() function in the "Number of threads" field of the Thread Group 来启动那么多线程,因为 CSV 文件中有以下行:

${__groovy(new File('/path/to/your/file.csv').readLines().size(),)}

这样 JMeter 将启动与 CSV 文件中的行数相等的线程数。

如果您还想确保线程在同一时刻执行采样器,您可以使用 Synchronizing Timer