gpt4 book ai didi

csv - 如何在 JMeter 的 while 循环中使用 CSV 数据集配置?

转载 作者:行者123 更新时间:2023-12-04 13:23:56 30 4
gpt4 key购买 nike

我需要针对 5 到 10 个服务器测试相同的一组 url。 URL 在 CSV 文件中定义。服务器名称在用户定义的变量配置中定义。

我正在使用基于服务器数量的 While Controller 来迭代和执行 url 请求。我当前的逻辑定义如下:

Thread group
While controller
Counter (defines number of servers)
While controller (inner check "${URL}" != "<EOF>")
CSV Data Set Config (stop EOF is true)
HTTP Sampler (with url data)

根据逻辑,我的脚本将运行并读取一次 CSV 文件并停止。它不是在读取外循环。只有内循环并停止。

最佳答案

引自 JMeter Manual of CSV Data Set :

By default, the file is only opened once, and each thread will use adifferent line from the file. However the order in which lines arepassed to threads depends on the order in which they execute, whichmay vary between iterations. Lines are read at the start of each testiteration. The file name and mode are resolved in the first iteration.


线程组不能嵌套。 所以你必须 使用线程组在 CSV 中进行迭代并使用 foreach 在其他内容中进行迭代 .第二个选项是 生成带有 URL+Server 变体的 CSV ,并仅使用单个线程组来读取 CSV。
第一个选项在这里。
迭代 URL 外循环,迭代服务器内循环。你只需要一个线程组和一个 foreach 在里面。看图片:
User defined variables (servers)
enter image description here
enter image description here
enter image description here
示例结果:
enter image description here
enter image description here
enter image description here
当然还有 3 个结果......
你也可以玩 CSVRead function如果你有时间 :)

关于csv - 如何在 JMeter 的 while 循环中使用 CSV 数据集配置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13093282/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com