My test is running on Linux VM via JMeter [command line]. Access logs of apache server shows that few requests didn't reached to it and for few requests, it is giving 400 response [i.e. bad request]
So i wanted to capture all requests going from JMeter and with parameters if possible.
Is there any way of doing it?
You can do it using tcpdump tool like:
tcpdump -i any -s0 -w /path/to/dump.pcap
And once JMeter test finishes open dump.pcap file with Wireshark and inspect packets
Alternative option is configure JMeter to save request and response data. It can be done in 2 ways:
Add the following lines to user.properties file (lives in "bin" folder of your JMeter installation)
jmeter.save.saveservice.output_format=xml
jmeter.save.saveservice.response_data=true
jmeter.save.saveservice.samplerData=true
jmeter.save.saveservice.requestHeaders=true
jmeter.save.saveservice.url=true
jmeter.save.saveservice.responseHeaders=true
pass above properties via -J command-line argument like:
./jmeter -Jjmeter.save.saveservice.output_format=xml -Jjmeter.save.saveservice.response_data=true -Jjmeter.save.saveservice.samplerData=true -Jjmeter.save.saveservice.requestHeaders=true -Jjmeter.save.saveservice.url=true -Jjmeter.save.saveservice.responseHeaders=true -n -t example.jmx -l example.jtl
Once test finishes open resulting example.jtl file in JMeter GUI with View Results Tree listener - you will be able to see request and response details along with parameters, variables, etc.
References:
JMeter Non-GUI Mode (Command Line mode)
Apache JMeter Properties Customization Guide
Related
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
I am a beginner to Jmeter.My goal is to test the performance of 1000000 API requests.I have started testing in GUI mode but after reaching 5000 requests it's throwing an error.From that error I noticed that I have to run the Jmeter in Non-GUI mode to run more number of requests.I have started running in Non-GUI mode it's giving the result in summary format.I want to see which API is success and failed as in GUI mode we are able to see in view results tree listener.
You can create JMeter Dashboard to see the results. Run the test in non gui mode as below:
jmeter -n -t /path/to/testplan -l /path/to/result.jtl
once your test is complete you can use (.jtl) file to generate dashboard
run the command as below:
jmeter -g /path/to/result.jtl -o OUTPUT_FOLDER
Check the output folder --> index.html, you will see the list of API requests you have sent.
Normally when you run JMeter in command-line non-GUI mode you should specify the .jtl results file where the test output will be stored like:
jmeter -n -t test.jmx -l result.jtl
^test ^file with
plan test results
Once your test is finished you can:
Open the result.jtl (it's a normal CSV file) with MS Excel or LibreOffice Calc and analyze the results there
Open the result.jtl file with the Listener of your choice, i.e. Aggregate Report
Generate tables and/or charts you need using JMeterPluginsCMD Command Line Tool
Generate HTML Reporting Dashboard from the .jtl results file
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.
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
I have a simple HTTP Request sampler in a test plan. And, viewing the result through "Aggregate Report" and writing the same results to a file. I have used "SMTP Sampler" in "tearDown Thread Group" and also used the "Test Action" to wait for a while.
Issue is, once I execute the test-case, in mail I got the previous run results instead of the new one.
Here is the screen-shot of my test plan.
Please help. Thanks in advance!
I don't like your "Test Action to wait for a while" approach as it may be not enough so you won't be able to tell for sure whether JMeter stored the most recent results or not.
I would suggest the following: add jmeter.save.saveservice.autoflush=true line to user.properties file (it's located under /bin folder of your JMeter installation) and on next JMeter start it will be storing every single line.
So
Apply aforementioned property change
Configure your SMTP Sampler to send results.jtl file
Disable all the listeners.
Run JMeter in command-line non-GUI mode as follows
jmeter -n -t /path/to/your/testplan.jmx -l /path/to/results.jtl
As an alternative to editing user.properties file you can pass the property via -J command line argument like:
jmeter -Jjmeter.save.saveservice.autoflush=true -n -t /path/to/your/testplan.jmx -l /path/to/results.jtl
See Apache JMeter Properties Customization Guide for more information on JMeter properties and ways of working with them.