JMeter的CSV数据集配置:如何通过移动的变量在同一个线程? [英] JMeter CSV Dataset Config: how to move through variables in the same thread?

查看:497
本文介绍了JMeter的CSV数据集配置:如何通过移动的变量在同一个线程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是CSV数据集config元素,这是从这样的文件中读取:

I'm using a CSV dataset config element, which is reading from a file like this:

abd
sds
ase
sdd
ssd
cvv

其中,基本上,拥有一批3个字母的随机字符串的。

Which, basically, has a number of 3 letter random string.

我将其分配给一个叫做变量 $ {random_3}

I'm assigning them to a variable called ${random_3}.

现在,我想在同一个线程中多次使用值从这个名单,但我希望每次移动到下一个。例如,我希望第一个采样器使用 ABD ,第二个用 SDS ,那么 ASE 等,但如果我只是用 $ {random_3} 则仅被用于任何地方,它被称为第一个(ABD)。有没有一种方法我可以通过从CSV数据值的线程中指定要循环?

Now, I want to use values from this list multiple times within the same thread, but each time I want to move to next. For example, I want the first sampler to use abd, the 2nd to use sds, then ase, etc. But if I just use ${random_3} then only the first one (abd) is used wherever it's referred to. Is there a way I can specify to loop through the values from the CSV dataset within a thread?

推荐答案

CSV数据集配置工作正常此。所有值的需要在该文件中的一列,并如所描述它们分配给变量。

CSV Data Set Config works fine for this. All of the values need to be in one column in the file and assign them to the variable as described.

创建一个线程组只要你想遍历文件(即作用于HTTP请求),有尽可能多的用户尽可能多的线程。假设1个用户,设定线程的数量为1,循环计数为1。

Create a Thread Group that has as many threads for as many users as you want iterating over the file (i.e. acting on the HTTP Request). Assuming 1 user, set the number of threads to 1, loop count to 1.

线程组内,您将需要添加的回路控制器虽然控制器。您表示要通过整个数据集循环。如果添加一个回路控制器,你会想设置循环计数为6,既然你有6个值,每个值。或者(更容易处理整个文件)添加在控制器而不是一个回路控制器,并设置$ {} random_3作为while条件。

Inside the thread group you will need to add a Loop Controller or a While Controller. You indicated that you want to loop through the whole data set. If you add a loop controller you will want to set the Loop Count to 6, since you have 6 values, one for each value. Alternately (and easier for processing the whole file) add a While Controller instead of a Loop Controller and set ${random_3} as the while condition.

设置CSV数据集是非常重要的在EOF回收在EOF停止线程值正确。如果您打算在文件迭代不止一次必须设置回收的EOF来的真正的(即指示JMeter的回迁CSV文件的顶部)。设置关于EOF停止线程来的的,如果你使用的是回路控制器,的真正的,如果你使用了一段时间的控制器,并想读取整个CSV数据后停止。

It is important to set the CSV Data Set Recycle on EOF and Stop Thread on EOF values correctly. If you plan to iterate over the file more than once you must set "Recycle on EOF" to True (i.e. instruct jMeter to move back to the top of the CSV file). Set "Stop Thread on EOF" to False if you are using a loop controller, true if you are using a while controller and want to stop after reading the whole csv dataset.

添加CSV数据集配置作为控制器与HTTP请求一起的孩子。用你想用的任何监听器查看结果。

Add the CSV Data Set Config as a child of the controller along with the HTTP Request. View the results using any listener you want to use.

这篇关于JMeter的CSV数据集配置:如何通过移动的变量在同一个线程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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