我有一个包含 100 条记录/行的 CSV,我希望使用 JMeter 执行(通过服务)。
现在,我想对每条记录执行 3 次(每次延迟 5 秒),并对 CSV 中的所有 100 条记录执行相同的操作。
我如何使用 JMeter 做到这一点?
最佳答案
使用 jmeter 的 standard components 看起来并不难实现.
- 使用正确配置的 CSV Data Set Config在 While Controller 下从您的 csv 文件中读取所有条目。
- 在同一个循环中使用Loop Controller设置为所需的循环计数 - 这将使用从每个 csv 条目中提取的变量重复您的请求 N 次。
- Under Loop Controller 使用合适 sampler ,例如HTTP Request Sampler , 用来自 csv-entry 的参数发送您的请求。
- 与采样器一起使用任何 timer ,例如Constant Timer , 在每个请求后添加延迟。
架构可能如下所示:
Thread Group Number of Threads = 1 Loop Count = 1 . . . While Controller // this will iterate through your csv-file Condition = ${__javaScript("${var1}"!="",)} // this will repeat until EOF CSV Data Set Config Filename = ... // path to your csv file Variable Names = var1,... // these are records read from file into pointed variables Delimiter = , Recycle on EOF? = False Stop thread on EOF? = True Sharing Mode = Current thread group Loop Controller Loop Count = 3 HTTP Request Sampler Constant Timer Thread Delay (in ms) = 5000 . . .
关于java - Jmeter 多次执行来自 CSV 的每条记录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12294680/