nested loop with file1.csv and file2.csv in jmeter

2019-02-18 08:18发布

问题:

I am using Apache JMeter and I need to run function call in 2 nested loops driven by csv datafiles. There is similar Q&A at How to implement nested loop in jmeter? but it's not based on datafiles.

I have 2 files:

long.csv:

1
2
3
...
100.000

and short.csv:

a
b
c

I need to run nested loop test with data from those files

foreach x from long.csv
  foreach y from short.cvs
    call(x,y)

and I want the calls look like this:

call(1,a)
call(1,b)
call(1,c)
call(2,a)
call(2,b)
call(2,c)
call(3,a)
call(3,b)
call(3,c)
...
call(100000,a)
call(100000,b)
call(100000,c)

The calls may be reordered, but I need unique call on every combination of inputs.

Suggestions?

回答1:

If you are looking for detailed steps, please check here.

http://www.testautomationguru.com/jmeter-looping-2-csv-files/


I tried & it seems to work - Please check below snapshot for details.

CSV Data set Config 1 reads a csv file - the var ref name is 'vara'. it has 10 rows , 1-10

CSV Data set Config 2 reads another csv file , contains 3 rows a, b c - and the var ref name is 'varb'. 'Allow ReCycle on EOF?' is set to True.

Thread Loop Count is for CSV Data set Config 1
Inner Loop Controller's loop count is for CSV Data set Config 2