问题
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?
回答1:
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 packetsAlternative 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
来源:https://stackoverflow.com/questions/37044547/how-can-we-capture-all-requests-going-from-jmeter-running-on-linux