Jmeter: HTML report generation after tests - jmeter

These are the steps that I followed to generate reports:
I have the .jtl file
I copy paste given sample configuration to my user.properties file located at apache-jmeter-5.0\bin
I convert .jtl to aggregate report using CMDRunner.jar
java -jar CMDRunner.jar --tool Reporter --generate-csv Demo17Results.csv --input-jtl Demo17Results.jtl --plugin-type AggregateReport
Convert csv file got from step#3 to HTML reports
I tried (1) jmeter -g Demo17Results.csv -o htmlReports/
Error: csv' does not contain the field names header, ensure the jmeter.save.saveservice.* properties are the same as when the CSV file was created or the file may be read incorrectly when generating report
An error occurred: Mismatch between expected number of columns:17 and columns in CSV file:11, check your jmeter.save.saveservice.* configuration or check line is complete
I tried (2) jmeter -n -t Demo17Run.jmx -l Demo17Results.csv -e -o htmlReports/
Creating summariser <summary>
Error in NonGUIDriver java.lang.IllegalArgumentException: Results file:Demo17Results.csv is not empty
after emptying the csv file
Creating summariser <summary>
Created the tree successfully using Demo17Run.jmx
Starting the test
Waiting for possible Shutdown/StopTestNow/Heapdump message on port 4445
summary = 0 in 00:00:00 = ******/s Avg: 0 Min: 9223372036854775807 Max: -9223372036854775808 Err: 0 (0.00%)
Tidying up ...
Error generating the report: org.apache.jmeter.report.core.SampleException: Could not read metadata !
... end of run
What am I doing wrong to generate Jmeter HTML dashboard reports?

You don't need step 2, JMeter default configuration is just fine for dashboard generation
You don't need step 3, the dashboard needs to be created from the Demo17Results.jtl file which contains full raw results, not statistics table
Try re-running your test scenario with forcing deletion of the previous result file via -f argument:
jmeter -n -f -t Demo17Run.jmx -l Demo17Results.jtl -e -o htmlReports/
If nothing helps double check you have not modified required results file configuration settings and increase JMeter logs verbosity for report.dashboard package by adding the next line to log4j2.xml file:
<Logger name="org.apache.jmeter.report.dashboard" level="debug" />

I was getting a similar error when I was trying to generate the HTML dashboard report after the test run. Even though the path to the .jtl file was correct (and there were no spaces in the directory names), I was getting that error “Mismatch between expected number of columns...” I was pointing the command to a copy of the .jtl file I had made in another directory. I changed the command to pick up the .jtl file that was in JMeter\bin and that worked… no more error and the reports were generated. So, the command (run from JMeter\bin) that worked was: jmeter –g log.jtl –o C:\HTML_Reports.
Also, the output folder that is specified must not exist (JMeter will create it) or if it does exist, it must be empty.

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

Jmeter - Run .jmx file through command line and get the summary report in a html, csv as well as XML output - All three

Currently, I am giving below on the command line. When I add CSV, it doesn't give output in csv format. Can you please provide complete command for all three outputs.
Sample 1:
!JMeter -Jjmeter.save.saveservice.samplerData=true -Jjmeter.save.saveservice.response_data=true -Jjmeter.save.saveservice.output_format=xml -Jjmeter.save.saveservice.responseHeaders=true -Jjmeter.save.saveservice.requestHeaders=true -n -t ProgramServices.jmx -l JmeterReports\TestReport.xml -j JmeterReports\jmeter.log
Sample 2:
JMeter -n -t Creation_SLW.jmx -l JmeterReports/TestReport.csv -e -o JmeterReports/htmlReport/ -j JmeterReports/jmeter.log
As per Generating Report Dashboard documentation
The dashboard generator is a modular extension of JMeter. Its default behavior is to read and process samples from CSV files to generate HTML files containing graph views. It can generate the report at end of a load test or on demand.
So as of latest JMeter 5.4.1 you can only generate the HTML dashboard from .jtl file which is in CSV format and the contents of the file has to be inline with the Result File Configuration
I would recommend reverting your changes and going for CSV + HTML Reporting Dashboard with the default configuration (or with your necessary amendments)
If you need XML with the full data as well - you can add i.e. Simple Data Writer to your test plan and specify the desired file name and the metrics which you want to store:
More information: How to Save Response Data in JMeter

Jmeter: How to save jtl logs in parts in non-gui mode

I'm getting result in GBs under jtl files, so how I can save jtl files in parts so that I can delete older files during Jmeter run.
jmeter -n -t test.jmx -j D:\jmeter.log -l D:\jmeterJTL.jtl
Above command will save the jmeter.log and jmeterJTL.jtl file in directory (D:). But I'm getting 1 gb data in 1 hour so how I can save this in parts: jmeter1.log jmeter2.log jmeter3.log ... and jmeterJTL1.jt1 jmeterJTL2.jt1 jmeterJTL3.jt1 ...
Note: I'm also saving result in .jtl to logged in thread name so that I can debug. Is there any alternative for this?
You are writing more response data (might be whole response data). You can reduce the file size by configuring the below properties.
In your jmeter.properties or user.properties file, use the following:
jmeter.save.saveservice.output_format=csv
jmeter.save.saveservice.subresults=false
You can check this blazemeter blog to learn more about how to tune the performance of JMeter.

How to print 95 and 99 Percentiles in the jmeter aggregate report command line?

I am trying to print 95 Percentile and 99 Percentile response times in the jmeter aggregate report from the command line
For this, I have tried the solution mentioned in here: Jmeter: Generating aggregate report through commnd line is not including 95% and 99% line in generated report
but that didn't work. I have tried editing the jmeter.properties file too.
Also, the other solution that I came across is to generate the ResponseTimesPercentiles graph using CMDRunner.jar in csv format but that gives all the values from 0-99.9 which I don't need. So is there a way I can customize the csv file to just have ReponseTimesPercentiles for desired values?
Also tried this command:
java -jarCMDRunner.jar --tool Reporter --generate-csv test.csv --input-jtl results.jtl --include-labels aggregate_report_99%_line --plugin-type AggregateReport
which didn't work.
So, is there any way that I can generate the 95% and 99 Percentiles in the aggregate report
The functionality is available by default starting from JMeter version 2.13
The behavior is controllable via the following properties:
aggregate_rpt_pct1=90
aggregate_rpt_pct2=95
aggregate_rpt_pct3=99
If you don't see percentiles like at the above image in your Aggregate Report - add the above lines to user.properties file.
NB:
The approach won't work on JMeter versions earlier than 2.13
JMeter restart will be required to pick the properties up, dynamic changes won't work.
You can do it from CMD, First make the plan using GUI, then in the bin folder of Jmeter, open CMD and run the following command.
jmeter -n -t "[PATH-FOR-PLAN]\myplan.jmx" -l "[PATH-OF-RESULT]\results.csv" -e -o "[PATH-OF-OUTPUT]\output"
The output folder will have a webpage with the aggregate report

Resources