gpt4 book ai didi

testing - 我可以在 jmeter 的 csv 数据集配置器中有一个可变参数吗

转载 作者:行者123 更新时间:2023-11-28 21:19:10 25 4
gpt4 key购买 nike

enter image description here

这是我的测试计划,第一个 CVS 数据集配置是这样的

enter image description here

第二个CSV数据集的配置是这样的

enter image description here

我想读取一个包含所有文件名的文件并进入每个文件并读取每一行并形成一个 http 请求并访问服务器。我不想使用循环 Controller ,因为我需要在单个文件中的请求方面的并发性。

假设 file1.csv 包含 10 行,相当于 10 个 http 调用,我有 5 个线程,那么线程必须同时处理 10 个调用

最佳答案

你不能。 CSV Data Set ConfigConfiguration Element ,根据文档:

Configuration elements can be used to set up defaults and variables for later use by samplers. Note that these elements are processed at the start of the scope in which they are found, i.e. before any samplers in the same scope.

JMeter 测试元素 execution order看起来如下:

0. Configuration elements
1. Pre-Processors
2. Timers
3. Sampler
4. Post-Processors (unless SampleResult is null)
5. Assertions (unless SampleResult is null)
6. Listeners (unless SampleResult is null)

因此您的${file} 变量将为空,除非执行采样器,并且第二个 CSV 数据集配置将在任何采样器执行之前初始化。

如果您想动态地从文件中读取数据,请考虑使用 __StringFromFile()__CSVRead()代替功能。

函数在调用时会被求值,因此基本上您可以将函数放在脚本中的任何位置。查看How to Pick Different CSV Files at JMeter Runtime如果需要,请参阅文章以获取更多详细信息。

关于testing - 我可以在 jmeter 的 csv 数据集配置器中有一个可变参数吗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54283708/

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