You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by jw68 <we...@sbcglobal.net> on 2008/09/25 19:28:32 UTC

Multiple CSV files

Can I use multiple CSV Data Set Config's to accomplish the following
scenario:

I have 2 (or n) csv files and I want to iterate through each line in first
file and for each line in the first file I want to iterate trough each line
in the second file

Logically something like this:

Files:
CSV File 1:
a,b
c,d
e,f
CSV File 2:
1,2
3,4

The output, if I use a Sampler that writes to a log file, should look
something like this:

a,b,1,2
a,b,3,4
c,d,1,2
c,d,3,4
e,f,1,2
e,f,3,4

So basically a sampler would be executed 6 times with the above 2 files.
Currently I can only get the following to happen 

a,b,1,2
c,d,3,4
e,f,1,2

Note: I do not know how many rows are in each of the CSV files. That is
changing dynamically.

Thx




-- 
View this message in context: http://www.nabble.com/Multiple-CSV-files-tp19674514p19674514.html
Sent from the JMeter - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: Multiple CSV files

Posted by sebb <se...@gmail.com>.
On 25/09/2008, jw68 <we...@sbcglobal.net> wrote:
>
>  Can I use multiple CSV Data Set Config's to accomplish the following
>  scenario:
>
>  I have 2 (or n) csv files and I want to iterate through each line in first
>  file and for each line in the first file I want to iterate trough each line
>  in the second file
>

You need to use a nested loop.

Loop 1
+ CSV 1
+ Loop 2
+ +  CSV 2
+ + Sampler

>  Logically something like this:
>
>  Files:
>  CSV File 1:
>  a,b
>  c,d
>  e,f
>  CSV File 2:
>  1,2
>  3,4
>
>  The output, if I use a Sampler that writes to a log file, should look
>  something like this:
>
>  a,b,1,2
>  a,b,3,4
>  c,d,1,2
>  c,d,3,4
>  e,f,1,2
>  e,f,3,4
>
>  So basically a sampler would be executed 6 times with the above 2 files.
>  Currently I can only get the following to happen
>
>  a,b,1,2
>  c,d,3,4
>  e,f,1,2
>
>  Note: I do not know how many rows are in each of the CSV files. That is
>  changing dynamically.
>

If it changes before the test, then you can pass in the number of
loops for Loop 2.
Loop 1 can use CSV Dataset/exit on EOF.

Otherwise it's impossible with the current JMeter unless there is some
way of marking the last entry in the CSV 2 file - e.g. add an extra
column, and use that variable to exit the inner loop (which should be
a while loop).

However, you could just merge the CSV files using a script before
running the test.

>  Thx
>
>
>
>
>
>  --
>  View this message in context: http://www.nabble.com/Multiple-CSV-files-tp19674514p19674514.html
>  Sent from the JMeter - User mailing list archive at Nabble.com.
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>  For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org