I have the following test plan:
I want to have 1 thread on each line of csv file.
How can I achieve it?
I have the following test plan:
I want to have 1 thread on each line of csv file.
How can I achieve it?
It is possible, but you will need to count lines in CSV file before jmeter starts, like:
In JMeter define "Number of threads" using __P() function like
${__P(threads,)}
You can pass threads
property value via -J
command-line argument like
jmeter -Jthreads=60 ....
You can use your operating system commands to count lines in CSV file like:
for MS Windows use "for" loop as Xoce 웃 Пepeúpa suggests, like create i.e. runtest.bat
file like:
setlocal EnableDelayedExpansion
set "cmd=findstr /R /N "^^" PATH_TO_YOUR_FILE.CSV | find /C ":""
for /f %%a in ('!cmd!') do set threads=%%a
jmeter.bat -Jthreads=%threads% -n -t test.jmx ...
for Linux/Unix you can use wc and awk commands combination and run JMeter like:
./jmeter -Jthreads="$(wc -l PATH_TO_YOUR_FILE.CSV | awk {'print $1'})" -n -t test.jmx
Theoretically Linux way should be suitable for OS X as well.
See Apache JMeter Properties Customization Guide for more information on JMeter properties and ways of working with them