linoor
linoor

Reputation: 241

Issue with maximum number of command line arguments in JMeter

I'm passing a couple of command line arguments from my python script to JMeter like this:

    command = [jmeter_command_line, jmeter_test_file,
               '-JTHREADS={threads_limit}'.format(threads_limit=threads_limit),
               '-JDURATION={0}'.format(duration_seconds_all_tests),
               '-JTEST_URL="{0}"'.format(test_url),
               '-JTEST_NAME="{0}"'.format(test_name),
               '-JTEST_OUTPUT_DIR="{0}"'.format(output_dir),
               '-p', jmeter_properties]
    call(command)

Everytime I run the script the two last two arguments are not being read by JMeter. Here's a sample of log file:

2016/05/19 09:41:51 INFO  - jmeter.JMeter: Loading system properties from: C:\Users\user\Downloads\apache-jmeter-2.13\bin\system.properties 
2016/05/19 09:41:51 INFO  - jmeter.JMeter: Setting JMeter property: THREADS=5 
2016/05/19 09:41:51 INFO  - jmeter.JMeter: Setting JMeter property: DURATION=15 
2016/05/19 09:41:51 INFO  - jmeter.JMeter: Setting JMeter property: TEST_URL="some/path" 
2016/05/19 09:41:51 INFO  - jmeter.JMeter: Setting JMeter property: TEST_NAME="testname"  

But when I switch the order of the last two arguments like this:

command = [jmeter_command_line, jmeter_test_file,
               '-JTHREADS={threads_limit}'.format(threads_limit=threads_limit),
               '-JDURATION={0}'.format(duration_seconds_all_tests),
               '-JTEST_URL="{0}"'.format(test_url),
               '-JTEST_OUTPUT_DIR="{0}"'.format(output_dir), <-- lines changed
               '-JTEST_NAME="{0}"'.format(test_name),        <-- lines changed
               '-p', jmeter_properties]
    logger.debug(' '.join(command))
    call(command)

It's the same, the last arguments are dropped:

2016/05/19 10:08:30 INFO  - jmeter.JMeter: Loading system properties from: C:\Users\user\Downloads\apache-jmeter-2.13\bin\system.properties 
2016/05/19 10:08:30 INFO  - jmeter.JMeter: Setting JMeter property: THREADS=5 
2016/05/19 10:08:30 INFO  - jmeter.JMeter: Setting JMeter property: DURATION=15 
2016/05/19 10:08:30 INFO  - jmeter.JMeter: Setting JMeter property: TEST_URL="test/url" 
2016/05/19 10:08:30 INFO  - jmeter.JMeter: Setting JMeter property: TEST_OUTPUT_DIR="path/to/results" 

So it seems to me that there is a limit to how many arguments I can provide to JMeter. Is there something I am missing? I was looking for an answer in the JMeter docs, but I haven't found anything indicating that there is such a limit. I don't think it's a fault of Python code because I checked that it calls all of the arguments.

Upvotes: 1

Views: 828

Answers (2)

linoor
linoor

Reputation: 241

The problem was that I was running jmeter in non-GUI mode on windows by calling the jmeter-n.cmd script. The script has the following lines:

rem use same directory to find jmeter script
call "%~dp0"jmeter -n -t "%~nx1" -j "%~n1.log" -l "%~n1.jtl" %2 %3 %4 %5 %6 %7 %8 %9

So the way it is written it can't call more than 10 arguments.

The solution was to run it directly using the jmeter -n -t script_name.jmx script.

Upvotes: 1

blue
blue

Reputation: 217

jmeter should be based on the maximum number of server jvm you come, and you and the script itself is not directly related, reference http://performancewebautoamtionother.blogspot.sg/2015/12/jmeter-and-javavisualvm.html hope to help you

Upvotes: 0

Related Questions