如何使用CSV配置集的共享模式在Jmeter中运行线程? [英] How to use CSV Config Set's sharing mode to run thread in Jmeter?

查看:624
本文介绍了如何使用CSV配置集的共享模式在Jmeter中运行线程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在CSV数据集配置中使用共享模式"的此选项编辑"?我在官方网站上找到了说明?

Is there any way to use this option "edit" of "share mode" in CSV Data Set Config? I have found the description in official web site?

Apache jmeter组件CSV数据集配置

标识符-共享相同标识符的所有线程共享相同的标识符 文件.因此,例如,如果您有4个线程组,则可以使用 两个或多个组之间共享文件的通用ID 他们.或者您可以使用线程号在两个线程之间共享文件 不同线程组中的线程号相同.

Identifier - all threads sharing the same identifier share the same file. So for example if you have 4 thread groups, you could use a common id for two or more of the groups to share the file between them. Or you could use the thread number to share the file between the same thread numbers in different thread groups.

但是我不知道通用ID和线程号的含义是什么?如何将它们用于特定线程?

But I don't understand what is the mean of common id and thread number? How can I use them for the particular thread?

推荐答案

例如,您的file.csv具有以下内容:

For example you have file.csv with the following content:

line1
line2
line3
line4

还有2个线程组,其中有2个用户和1个循环执行采样器带有以下标签:

And 2 Thread Groups with 2 users and 1 Loop executing a Sampler with the following label:

Sampler ${__threadNum} - ${foo}

对于不同的共享模式设置,您将获得不同的行为,即:

For different Sharing Mode settings you will get the different behavior i.e.:

  • 用于共享模式All Threads:

Sampler 1 - line1
Sampler 1 - line2
Sampler 2 - line3
Sampler 2 - line4

  • 对于共享模式Current Thread Group,您将获得:

  • For sharing mode Current Thread Group you will get:

    Sampler 1 - line1
    Sampler 1 - line1
    Sampler 2 - line2
    Sampler 2 - line2
    

  • 对于共享模式Current Thread,您将获得:

  • For sharing mode Current Thread you will get:

    Sampler 1 - line1
    Sampler 1 - line1
    Sampler 2 - line1
    Sampler 2 - line1
    

  • 对于共享模式${__threadNum},您将获得:

  • For sharing mode ${__threadNum} you will get:

    Sampler 1 - line1
    Sampler 1 - line2
    Sampler 2 - line1
    Sampler 2 - line2
    

  • 示例测试计划:

    参考文献:

    • __threadNum() function
    • Using CSV DATA SET CONFIG

    这篇关于如何使用CSV配置集的共享模式在Jmeter中运行线程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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