How to use CSV Config Set's sharing mode to run thread in Jmeter?

一世执手 提交于 2019-12-30 10:26:15

问题


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 component CSV Data Set Config

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.

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


回答1:


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

line1
line2
line3
line4

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.:

  • For sharing mode All Threads:

    Sampler 1 - line1
    Sampler 1 - line2
    Sampler 2 - line3
    Sampler 2 - line4
    
  • For sharing mode Current Thread Group you will get:

    Sampler 1 - line1
    Sampler 1 - line1
    Sampler 2 - line2
    Sampler 2 - line2
    
  • For sharing mode Current Thread you will get:

    Sampler 1 - line1
    Sampler 1 - line1
    Sampler 2 - line1
    Sampler 2 - line1
    
  • For sharing mode ${__threadNum} you will get:

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

Example Test Plan:

References:

  • __threadNum() function
  • Using CSV DATA SET CONFIG


来源:https://stackoverflow.com/questions/42292760/how-to-use-csv-config-sets-sharing-mode-to-run-thread-in-jmeter

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!