在Jmeter中顺序读取Excel数据.csv文件 [英] Read Excel data .csv file sequentially in Jmeter

查看:1656
本文介绍了在Jmeter中顺序读取Excel数据.csv文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个场景,可以使用来自每行的数据通过HTTP请求进行验证.已经尝试使用CSV配置,但它仅读取迭代的第一行. 我只有一个迭代,所有采样器都在一个线程组中.仅当我将迭代的值设为3(每次迭代每行都记录一次)时,才从csv文件中依次获取数据

I have a scenario to use data from each row for validation using a HTTP Request. have tried with the CSV config but it reads the first row only for the iteration. I have a single iteration and all my samplers are in a single thread group. The data from csv file is retrieved sequentially only when i give the iterations to a value say 3 (each iteration each row is taken)

如何实现按顺序读取csv文件行以进行单次迭代,其中线程组包含许多HTTP请求,而我需要为每个请求从每一行获取值.

How to achieve on reading the csv file rows sequentially for single iteration ,where the thread group contains many HTTP request and i need the value from each row for each requests.

请给我一个解决方案

推荐答案

根据 CSV数据集配置文档:

默认情况下,文件仅打开一次,并且每个线程将使用与文件不同的行.但是,将行传递到线程的顺序取决于它们执行的顺序,这在每次迭代之间可能会有所不同. 在每次测试迭代开始时读取行.文件名和模式在第一次迭代中得到解决.

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

因此似乎无法使用CSV数据集配置实现方案,我建议考虑使用JMeter函数,例如:

So implementing your scenario using CSV Data Set Config doesn't seem to be possible, I would recommend considering using JMeter functions instead such as:

  • __StringFromFile()
  • __CSVRead()

这些函数每次被调用时都会从文件中读取下一行,因此您可以在每个HTTP请求采样器中使用它们而不是CSV数据集配置.请访问 Apache JMeter函数-简介以熟悉JMeter函数概念.

These functions read next line from the file each time they're called so you can use them instead of CSV Data Set config in each of the HTTP Request samplers. Check out Apache JMeter Functions - An Introduction to get familiarized with JMeter Functions concept.

这篇关于在Jmeter中顺序读取Excel数据.csv文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆