从 Jmeter 中的 CSV 文件中随机选择 [英] Random selection from CSV file in Jmeter

查看:22
本文介绍了从 Jmeter 中的 CSV 文件中随机选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个非常大的 CSV 文件(8000 多项),其中包含我正在使用 CSV 数据集配置元素读取的 URL.它正在填充 HTTP 请求采样器的路径并使用 while 控制器进行迭代.

I have a very large CSV file (8000+ items) of URLs that I'm reading with a CSV Data Set Config element. It is populating the path of an HTTP Request sampler and iterating through with a while controller.

这很好,除了我想要让每个用户(线程)从 CSV URL 列表中选择一个随机 URL.我不想要的是每个线程按顺序使用 CSV 项目.

This is fine except what I want is have each user (thread) to pick a random URL from the CSV URL list. What I don't want is each thread using CSV items sequentially.

我能够使用带有多个 HTTP 请求采样器的随机顺序控制器来实现这一点,但是 8000 多个 HTTP 采样器确实让 jmeter 陷入了无法使用的状态.所以这就是我将 HTTP 采样器 URL 放在 CSV 文件中的原因.但是,我似乎无法将随机顺序控制器与 CSV 文件数据一起使用.那么如何实现每个线程的随机 CSV 数据项选择?

I was able to achieve this with a Random Order Controller with multiple HTTP Request samplers , however 8000+ HTTP Samplers really bogged down jmeter to an unusable state. So this is why I put the HTTP Sampler URLs in the CSV file. It doesn't appear that I can use the Random Order Controller with the CSV file data however. So how can I achieve random CSV data item selection per thread?

推荐答案

还有另一种方法可以实现:

There is another way to achieve this:

  • 创建一个单独的线程组
  • 取决于您想要实现的目标:
    • 添加(随机)循环计数 -> 这将为执行工作的线程组设置起始偏移
    • 添加一个循环计数或永远和一个计时器,让它在另一个线程组运行时循环.该线程组将读取伪"随机行

    它并不是真正随机的,文件仍然是按顺序读取的,但是您的工作线程在文件中进行了跳转.它对我有用;-)

    It's not really random, the file is still read sequentially, but your work thread makes jumps in the file. It worked for me ;-)

    这篇关于从 Jmeter 中的 CSV 文件中随机选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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