I have a csv file that has a list of stores. For every Store there are 10 departments. I will need to make a GET API call for all the 10 departments in 100 stores. So my columns in CSV file are not eve. I will have column A with 100 store IDs, and column B with 10 department IDs. How can I use every Store ID 10 times (once with every department ID) in Jmeter sampler?
Asked
Active
Viewed 116 times
1 Answers
1
If you want to achieve this using CSV Data Set Config - the only way is splitting your CSV file into 2 separate files
If the CSV file comes from external source and cannot be changed - you can consider using __groovy() function like:
${__groovy(new File('test.csv').readLines().get(vars.get('__jm__Loop Controller - Store__idx') as int).split('\,')[0],)}
Given example CSV file test.csv
with the following contents:
store1,department1
store2,department2
,department3
,department4
,department5
,department6
,department7
,department8
,department9
,department10
You can achieve your requirement using below approach:
More information on Groovy scripting in JMeter: Apache Groovy - Why and How You Should Use It

Dmitri T
- 159,985
- 5
- 83
- 133
-
Thank your answer. It looks like it has to be using some coding as I will need to user the Store and the department as parameter in the same call. Otherwise the loop image it great. – Philipp Jun 11 '21 at 01:58
-
1It's not a problem to put both functions into a single request – Dmitri T Jun 11 '21 at 04:06