Details about which user from csv failed response assertion in Jmeter - jmeter

I am using JMeter to webUI performance testing. I have a list of users in csv with passwords. I am using response assertion to check failed password scenario.
How to record which user from csv is failed?

I would recommend going for Sample Variables property. For example, if you defined a ${username} which holds the user name from the CSV you can get it added to JMeter .jtl results file by adding the next line to user.properties file:
sample_variables=username
If you need to store more variables - provide them separated by commas:
sample_variables=username,password
Remember that:
JMeter restart is required to pick the property up
You can pass it via -J command line argument as well like:
jmeter -Jsample_variables=username,password -n -t test.jmx -l results.jtl
See Apache JMeter Properties Customization Guide for more information on different JMeter properties types and ways of working with them

Related

Jmeter command line option issue

I am running a load test using jmeter command line and saving the result into csv file using -l command line option. After the test is completed, i see the data in the csv and while i upload it to a view result tree and try to check the failure response data in the response section, i dont see any response data noted in there. Is there something am missing here?
i have the following command
<path to jmeter bat> -n -t <jmx loc> -l <loc of result.csv> -j <path to jmeterlog> -Gparam1 -Gparam2 -Gparam3 -Gjmeter.save.saveservice.output_format=csv -Gjmeter.save.saveservice.output_format=csv -Gjmeter.save.saveservice.assertion_results_failure_message=true -Gjmeter.save.saveservice.data_type=true -Gjmeter.save.saveservice.label=true -Gjmeter.save.saveservice.response_message=true -Gjmeter.save.saveservice.successful=true -Gjmeter.save.saveservice.thread_name=true -Gjmeter.save.saveservice.time=true -Gjmeter.save.saveservice.response_message=true -Gjmeter.save.saveservice.successful=true -Gjmeter.save.saveservice.thread_name=true -Gjmeter.save.saveservice.time=true -Gjmeter.save.saveservice.connect_time=true -Gjmeter.save.saveservice.assertions=true -Gjmeter.save.saveservice.latency=true -Gjmeter.save.saveservice.connect_time=true -Gjmeter.save.saveservice.thread_counts=true -Gjmeter.save.saveservice.response_data=true -Gjmeter.save.saveservice.response_data.on_error=true -Gjmeter.save.saveservice.response_message=true -Gjmeter.save.saveservice.samplerData=true -Gjmeter.save.saveservice.requestHeaders=true -e -o <Reportpath>
By default JMeter uses CSV format for saving test metrics
CSV format is not suitable for storing response data due to eventual delimiters and line breaks. Moreover as per Reducing resource requirements chapter it's not recommended to store response data.
If you really need to save response data you need to switch JMeter's .jtl file format to XML and instruct JMeter to store it, it's controllable via the following properties:
jmeter.save.saveservice.output_format - defaulting to csv
jmeter.save.saveservice.response_data - defaulting to false
So you need to amend your command line to override these properties like:
<path to jmeter bat> -Jjmeter.save.saveservice.output_format=xml -Jjmeter.save.saveservice.response_data=true ......
in order to make the changes permanent add the corresponding lines to user.properties file
More information:
Results file configuration
Configuring JMeter
Apache JMeter Properties Customization Guide
Another option is adding a separate Listener like Simple Data Writer and configure it to save response data into a separate file:

How to to get multiple output files with non-gui JMeter?

I need to have 2 output files, one with successes only and another one with failed status. First file must be in CSV format and another in XML (it must contain response data with response body). The solution must be in the non gui mode.
My current solution with one file:
jmeter.bat -Jjmeter.save.saveservice.output_format=xml -Jjmeter.save.saveservice.response_data=true -n -t JMeterFile.jmx -l OutputFile.jtl
I don't know how to make two output files with different content.
For the default .jtl file in CSV (for example suitable for generating HTML Reporting Dashboard) format run JMeter in command-line non-GUI mode like:
jmeter.bat -n -t JMeterFile.jmx -l OutputFile.jtl
For getting another file with detailed information on errors add a Listener, i.e. Simple Data Writer would be a good choice and configure it like:
This way you will get 2 files:
OutputFile.jtl - in CSV format with all metrics for all Samplers
Errors.xml - in XML format for failed samplers only having response data (you can tick other boxes as well if you want more details)
More information: How to Save Response Data in JMeter

Why jmeter generate other requests and put a number for them

I have a script, one of the requests in the script is: redireccion.html, but when I generate the HTML Dashboard report I see:
redireccion.html-0, redireccion.html-1, redireccion.html-2
Why those requests are generated by Jmeter?
HTML Dashboard Report Graph
This happens when your first request i.e. redireccion.html encounters a HTTP Redirect, i.e. gets a Redirection Message
JMeter stores all these redirects as sub-results
If you don't want these sub-results to be present in the HTML Reporting Dashboard - you can run your test providing jmeter.save.saveservice.subresults property with the value of false like:
jmeter -Jjmeter.save.saveservice.subresults=false -n -t test.jmx -l result.jtl -e -o dashboard
In order to make the change permanent - just add the next line to user.properties file:
jmeter.save.saveservice.subresults=false
More information: Apache JMeter Properties Customization Guide

How do I make jmeter use the different hostname/port for different threads of same test plan

In my test scenario I have to test 2 urls with different host and port under same test plan. Is it possible to do so
You can make variable as property and send to jmeter script
Add to Test Plan In User define variables 2 rows:
baseUrl with Value ${__P(baseUrl,localhost)}
port with Value ${__P(port,8080)}
localhost and 8080 are default values you can change it
and when you execute add the values you want e.g.:
jmeterw.cmd ... -JbaseUrl=192.168.0.33 -Jport=80
Define your host and port combinations in a CSV endpoints.csv file like:
somehost,someport
someotherhost, someotherport
and put the CSV file to the "bin" folder of your JMeter installation
Add CSV Data Set Config to your test plan and configure it like:
Set HTTP Request sampler to use ${host} and ${port} variables defined via the CSV Data Set Config
That's it, on each iteration (or virtual user hit) the next line will be picked up from the endpoints.csv file.
See Using CSV DATA SET CONFIG article for more information on parameterising JMeter tests using CSV files.

create summany report in jmeter from command line

I am using Jmeter version : 2.10. I test has couple of Http samplers. When i run the test from command line
jmeter.bat -n -t "C:\Jmeter Projects\TestSuite.jmx" -l "C:\Jmeter Projects\testResult.xml"
the result of the test creates "testResult.xml" but when i open it the data is in cvs format
1384844043490,1527,HTTP Request-1,200,OK,Thread Group 1-1,text,true,2776,1527
1384844045046,350,HTTP Request-2,200,OK,Thread Group 1-1,text,true,395,350
1384844045411,4890,HTTP Request-3,200,OK,Thread Group 1-1,text,true,977530,4888
1384844050304,286,HTTP Request-5 ,200,OK,Thread Group 1-1,text,true,4091,28
There is no header. I do not mind csv format if i can get the table header or the .jtl format.
I think it was since JMeter 2.8 that the default JTL format is CSV as opposed to XML. I didn't try this myself, but this should work for you:
-Jjmeter.save.saveservice.output_format=xml
Just make the changes as suggested by Alon and execute your test plan. Saving report as .jtl file.
jmeter.bat -n -t "C:\Jmeter Projects\TestSuite.jmx" -l "C:\Jmeter Projects\testResult.jtl"
Then using JMeter plugins generate the kind of report you wish for.

Resources