Chinni
Chinni

Reputation: 806

How can i provide different csv files via command line for the same JMX file in Jmeter

I would like to run the same JMX file for different loads/threads using different csv config files.Let's say csv files contains data for the username and password. For test1 csv file has 1000 rows for the test2 csv file has 2000 rows like that so on..

How can i provide different csv files via command line for the same JMX file for different thread count.

I know i can pass the threads,rampup,rampdown,duration by usin __P() function like ${__P(threads,)}via command line as below

jmeter -Jthreads=200 -Jrampup=10 -Jduration=1000 -Jrampdown=10 -n -t test1.jmx -l result1.jtl

Thanks, Raj

Upvotes: -1

Views: 760

Answers (1)

Dmitri T
Dmitri T

Reputation: 168162

You can do it just the same way as you do for Threads, Rampup, Duration, etc.

  1. In your CSV Data Set Config define the Filename using __P() function like:

    ${__P(csvFile,test1.csv)}
    

    enter image description here

    this will tell the CSV Data Set Config to read the filename from csvFile JMeter Property and use test1.csv if the property is not set (so you could debug your test in GUI mode)

  2. That's it, now you will be able to pass the file name using -J command-line argument like:

    jmeter -JcsvFile=/path/to/file2.csv -Jthreads=200 ....
    

    alternative way of setting up the property is putting the value in user.properties file. Check out Apache JMeter Properties Customization Guide for more information.

Upvotes: 1

Related Questions