JMETER:如何处理多个CSV文件,如果所有文件的列名都相同。

huangapple go评论50阅读模式
英文:

JMETER:- How to handle multiple CSV file if all files column name are same

问题

在JMeter中:如果我们在一个线程中有多个CSV文件(列名在所有文件中都相同,只是数据不同),如何从CSV文件中获取数据?在我的情况下,尽管文件名不同,但所有请求的数据都来自一个文件(第一个案例的CSV文件)。一旦我禁用其他请求并只运行单个请求,它就会从正确的文件中获取数据。JMETER:如何处理多个CSV文件,如果所有文件的列名都相同。

英文:

In Jemter:- How to fetch the data from CSV file if we have multiple CSV files for all cases inside a thread(column name is same in all file only data is different), in my case , for all request data is getting from one file only (first case's CSV ) even though file name is different. and once i disable other request and run only single request it will take data from proper file.JMETER:如何处理多个CSV文件,如果所有文件的列名都相同。

答案1

得分: 1

如果您有依赖的CSV文件,即尝试将第一个CSV文件中的变量用作第二个CSV文件的输入 - 这将无法工作。

根据JMeter用户手册的执行顺序章节:

  1. 配置元素
  2. 预处理器
  3. 定时器
  4. 取样器
  5. 后处理器(除非SampleResult为null)
  6. 断言(除非SampleResult为null)
  7. 监听器(除非SampleResult为null)

因此,作为配置元素,所有CSV数据集配置元素在测试开始时同时初始化。

如果您的测试配置非常动态,并且构建在来自多个CSV文件的数据关系之上,您将不得不使用__CSVRead()函数

查看如何在JMeter运行时选择不同的CSV文件以获取有关概念和示例解决方案的更多信息。

英文:

If you have dependent CSV files, i.e. trying to use variable from 1st CSV file as an input to 2nd CSV - it will not work.

As per Execution Order chapter of JMeter User Manual:

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)

So being Configuration Elements all the CSV Data Set Config elements are initialized at the same time at the beginning of the test.

If your test configuration is highly dynamic and built on relationship of data from multiple CSV files you will have to go for __CSVRead() function instead.

Check out How to Pick Different CSV Files at JMeter Runtime for more information on the concept and example solution.

huangapple
  • 本文由 发表于 2020年1月3日 13:50:50
  • 转载请务必保留本文链接:https://go.coder-hub.com/59573771.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定