问题
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 - line4For sharing mode
Current Thread Groupyou will get:Sampler 1 - line1 Sampler 1 - line1 Sampler 2 - line2 Sampler 2 - line2For sharing mode
Current Threadyou will get:Sampler 1 - line1 Sampler 1 - line1 Sampler 2 - line1 Sampler 2 - line1For 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