other commands executed failed after JMeter command-line - jmeter

execute JMeter test in command-line and deal with the output files
jmeter -n -t test.jmx -l output.jtl
copy output.jtl output_A.jtl
after execute this file, I find that the 2nd line copy... is not executed.
Actually, jmeter will be executed for a while, and the subsequent lines may be ignored.
Now I put jmeter in another file and call it from the main command file. Can I put them into one file?
How can I deal with such situation?

Maybe you need to add && between your commands like:
jmeter -n -t test.jmx -l output.jtl && copy output.jtl output_A.jtl
More information: Using multiple commands and conditional processing symbols

Related

Jmeter displays doubled results when running in non gui mode

I have a Test plan which when I run in the Gui Mode execute the sampler one time, but when I start the Test Plan from the command line I get the sampler to be running twice.
I have deleted the result.jtl file to insure that the results are not accumulated.
Without seeing your test plan it's hard or even impossible to say what's the reason as there are too many possible options, the most straightforward I can think of is:
You have a Listener (or two) somewhere in the test plan configured to write data into the same file which you specify via -l command-line argument
You have resultcollector.action_if_file_exists=APPEND property defined somewhere
So try out the following way of running the test:
jmeter -n -t test.jmx -l result.jtl -f -Jresultcollector.action_if_file_exists=DELETE
where:
-f forces JMeter to overwrite the .jtl results file
resultcollector.action_if_file_exists=DELETE property does the same for Listeners
More information:
Full list of JMeter command-line options
JMeter Properties Reference
Apache JMeter Properties Customization Guide

How to set thread count for remote servers in command-line mode

I am using the following command for distributed load testing in JMeter:
jmeter -JThreadCount="5" -n -t "path.jmx" -R IP1,IP2 -l "path.csv" -e -o "outputpath"
But it does not take 5 as the thread count but runs 2 times one for each remote system. When I remove the -R parameter it takes 5 as the thread count.
How to pass the ThreadCount (variables) to the remote servers?
I do believe that you need to use -G command-line argument in order to pass the
property to the remove slaves
I don't think you need these quotation marks around 5
Suggested amended command line:
jmeter -GThreadCount=5 -n -t "path.jmx" -R IP1,IP2 -l "path.csv" -e -o "outputpath"
More information:
Full list of JMeter command-line options
Overriding Properties Via The Command Line
How to Perform Distributed Testing in JMeter

Configure to start JMeter as systemd service

I generally use "nohup" to start Jmeter, Instead of using Cmd all the time, i have decided to configure a systemd service which runs the Jmeter all the time.
i have this below command: which basically run the jmeter and logs the output
nohup /app/jmeter/apache-jmeter-5.3/bin/jmeter -j /app/server-1/jmeter/logs/jmeter-traffic.log -n -t /app/jmeter/inputfile.jmx > /dev/null 2>&1 &
i Have created a .service file which runs the above command on
ExecStart=/app/jemter/apache-jmeter-5.3/bin/jmeter -j /app/jmeter/logs/jmeter-log -n -t /app/jmeter/inputfile.jmx > /dev/null 2>&1 &
when i started the service - i encountered various errors.
EX: class path contains multiple bindings
EX: failed to start the service
EX: failed at step EXEC spawing
EX: an error occured at arg: >
Is this the correct way of starting the service or should i be creating the shell script file to include the above command.
systemd knows nothing about your > operator so I would recommend leaving the command as it is:
ExecStart=/app/jmeter/apache-jmeter-5.3/bin/jmeter -j /app/jmeter/logs/jmeter-log -n -t /app/jmeter/inputfile.jmx
If you don't want to see JMeter output in the journal you can amend your systemd unit configuration like:
[Service]
StandardOutput=null
StandardError=journal
I would also suggest adding -l command line argument so you could store the results into a .jtl results file for further analysis
More information: How Do I Run JMeter in Non-GUI Mode?

How to run jmeter jmx files parallely from single command prompt

I have 5 different jmx files in my project. I need to do performance testing by running all these jmx files parallely. Currently i'm opening 5 different jmeter command prompt instance and triggering the execution.
Is there any way i can execute all these jmx files from 1 jmeter command prompt?
Depending on your operating system the options are in:
Linux: there is a parallel command, you can go for something like:
parallel --gnu << 'EOF'
jmeter -n -t test1.jmx -l result1.jtl
jmeter -n -t test1.jmx -l result2.jtl
etc.
EOF
Windows: you can create a batch script assuming start command something like:
start jmeter -n -t test1.jmx -l result1.jtl
start jmeter -n -t test2.jmx -l result2.jtl
etc.
As a cross-platform unified solution you can consider using Taurus tool as a wrapper for your JMeter script you can kick off multiple JMeter tests in parallel using simple declarative YAML syntax like:
---
execution:
- scenario:
script: test1.jmx
- scenario:
script: test2.jmx
- scenario:
script: test3.jmx
#etc
See Taurus - Working with Multiple JMeter Tests for more details.
You need to use some other tools like Ant or Maven or jenkins for that.
Please check the below link for more information:-
How to run multiple jmx scripts together in JMeter
Praveen, I don't think this is currently possible in JMeter to execute multiple .jmx files from single command , but I would suggest adding all 5 scripts in a single .jmx file if possible in your scenario.

Throughput Shaping timer- Externalising

I want to externalise the value for throughput shaping timer But not from Jmeter or User.properties as I have couple of other script to be executed with different work load model. I want a separate property file specifying the load pattern can you kindly suggest.
There is a load_profile property, you can define the desired Throughput Shaping Timer load model via it.
If you don't want to write down the value into jmeter.properties or user.properties file to permanently change the profile you can pass it via -J command line argument instead like:
jmeter -Jload_profile=const(10,10s) line(10,100,1m) step(5,25,5,1h) -n -t ...
Having separate file is also not a problem,
Create, i.e. test1.properties file in the "bin" folder of your JMeter installation
Put your desired load profile there:
load_profile=const(10,10s) line(10,100,1m) step(5,25,5,1h)
Pass this file to JMeter via -q command-line argument like:
jmeter -q test1.properties -n -t ...
Repeat steps 1-3 for 2nd test, you will be able to run it like:
jmeter -q test2.properties -n -t ...
References:
Full list of JMeter's command-line options
Configuring JMeter
Apache JMeter Properties Customization Guide

Resources