Apache JMeter Counting Number of User HTTP-Response 200 & 404 - jmeter

I am new using the Apache JMeter, I am currently using JMeter for stress test to load balancer. There are 2 Web Server pointing to the single database server. All the configuration load balancer was successfully configure and work fine. After using the JMeter, i able to create a different scenario, i.e shutdown one of the web server or removing the index file. JMeter also working fine display all the request and result each request either the thread (user) getting 404 or 200. Any idea on how to create and configure so that JMeter will display and count each the result, i.e How many number getting HTTP-response code 404 or 200 ? It possible to generate the result and transform it into the graph using the JMeter ?
Configuration:
Server
-Thread Group (50 Sample)
-HTTP Request
-Regular Expression Extractor (disabled)
-Response Assertion (disabled)
-View Result Tree
-Debug Sampler (disabled)
-Graph Results
-Summary Report

You do have the results already
Remove all the listeners from your Test Plan, the listeners don't add any value and just consume valuable resources
Run your JMeter test in command-line non-GUI mode like
jmeter -n -t test.jmx -l result.csv
Open the result.csv file with MS Excel or LibreOffice Calc or equivalent - you will have timeStamp and responseCode columns which will allow you to build some form of "Response code over time" chart
Another option is using Response Codes per Second chart:
It is not a part of JMeter distribution bundle, it can be installed using JMeter Plugins Manager
And finally you can store the status code of the response into a JMeter Variable using Regular Expression Extractor configured like:
once done you can add the next line to user.properties file:
sample_variables=statusCode
and plot this custom variable to the HTML Reporting Dashboard

You can generate JMeter dasboard which include Errors summary:
You can create dashboard using existing log file:
jmeter -g <log file> -o <Path to output folder>

Related

JMeter won't write response data

I'm running tests with JMeter (master+10 slaves) on elasticasearch. I'm getting error 400 for some requests but they are a bit elusive:
When I run the requests manually with curl or pasting them on kibana's console, I don't get errors.
Every time I run the tests using jmeter, using the same requests and under the same conditions, I get a different number of errors.
So I was thinking of inspecting the response bodies from jmeter. But all the ways I've tried failed:
I've created a View Result Tree element and checked all boxes on the "configure" panel. When I run the script, it logs everything except response data
I've tried a BeanShell post processor to write all responses on a file. But it apparently is being 'ignored' when I run the script
Both these solutions work on my machine, but not on the server (which I don't have total control over). I'm passing jmeter.save.saveservice.response_data=true on the command line to start jmeter.
What else could I try?
This is an optimization that JMeter makes for distributed testing related to the mode:
https://jmeter.apache.org/usermanual/properties_reference.html#remote_batching_config
To avoid JMeter stripping the response data set in user.properties of servers snd controller:
mode=Batch
As by default it is:
mode=StrippedBatch
By default JMeter slaves don't send response data to the master, you can choose a different sample sender if you need more data.
Writing response data into a file using Beanshell should work in any case (however consider using JSR223 Test Elements and Groovy for this), just make sure that:
your Beanshell PostProcessor is placed correctly according to JMeter Scoping Rules
there are no Beanshell-related messages in jmeter.log files
you will need to collect the log files from each slave manually after test run, they will not be generated on the master

Jmeter reports - How can I create a report that will list all samplers, in the order they ran, with success or fail results

We are using Jmeter for non-regression testing. We want a report with all samplers listed, in the order they ran, and with succes or fail. If fail, we want it to list the reason (which asserts failed and why).
This is the behavior we were getting with old Jmeter using a view result tree outputting to a xml file, and then using the XSL Jmeter transform to create a html report.
In the new report framework, I have not been able to find a way to reproduce this. All types of reports seems to do aggregations.
This is something which is available in JMeter out of the box for quite a while.
Given the following test structure and the results in the View Results Tree listener:
Given you run your JMeter test in command-line non-GUI mode like:
jmeter -n -t test.jmx -l result.csv
Once test finishes you can open the result.csv file using LibreOffice Calc or Microsoft Excel or equivalent and you will be able to see all the requests in the order in which they were executed with success status, assertion failure message (if present) and other JMeter metrics
You can control which metrics to store in the .jtl results file by amending properties responsible for the Results file configuration

I'm getting empty results attached in SMTP sampler

JMeter results I'm getting through different listener's,I want the results to come in mail
I tried it through smtp sampler
But, I'm getting mails without the results
I do not see any sign of attaching a file to the email in your SMTP Sampler, you should add the .jtl results file as attachment:
You may also need to amend one JMeter Property as by default JMeter doesn't store results as soon as samplers are finished, it flushes them to file in chunks
# AutoFlush on each line written in XML or CSV output
# Setting this to true will result in less test results data loss in case of Crash
# but with impact on performances, particularly for intensive tests (low or no pauses)
# Since JMeter 2.10, this is false by default
#jmeter.save.saveservice.autoflush=false
So add the next line to user.properties file:
jmeter.save.saveservice.autoflush=true
and restart JMeter to pick the property up. Or alternatively you can set the property via -J command-line argument like:
jmeter -Jmeter.save.saveservice.autoflush=true -n -t test.jmx -l result.jtl
See Configuring JMeter and Apache JMeter Properties Customization Guide for more information on tuning JMeter using properties.

How to log only error responses in jmeter

I have the following params setup on jmeter, I am running my script in a loop which is creating huge logs(jtl file), Can I log only error responses ?
You can configure JMeter to save response data only for failed samplers by adding the next lines to user.properties file:
jmeter.save.saveservice.response_data=false
jmeter.save.saveservice.response_data.on_error=true
If you want to completely disable saving any metrics for successful samplers add the next line to the same file (however you won't be able to get reliable metrics this way):
jmeter.save.saveservice.successful=false
References:
Configuring JMeter
Apache JMeter Properties Customization Guide

loading .jtl file does not give complete result in gui, can not see response data

I am running Jmeter in non-gui mode. When I load the resulting.jtl file in jmeter I can see sample result but it does not give me sampler request and response data. Help appreciated!
By default sampler request and response data are not stored in the .jtl file. To override this behavior you need to "tell" JMeter to store the data. To do so locate the following properties in jmeter.properties file which lives under /bin folder of your JMeter installation, uncomment and change to "true" values of the following:
#jmeter.save.saveservice.samplerData=false
#jmeter.save.saveservice.response_data=false
Alternatively you can pass these properties during command-line execution via -J key as follows:
jmeter -Jjmeter.save.saveservice.samplerData=true -Jjmeter.save.saveservice.response_data=true -n -t /path/to/your/script.jmx -l /path/to/results/file.jtl
See Apache JMeter Properties Customization Guide for more information on dealing with JMeter properties.
Also be aware of the fact that storing requests and especially responses will have negative impact on your load generator(s) performance.

Resources