An Error message occurs on command prompt while generating Dashboard from Jmeter - jmeter

I have started using JMeter 3.1 recently for load testing, all I wanted to do was generate a report dashboard from a csv file.
When I run the following command from Command Prompt:
jmeter -g (csv file location) -o (Destination folder to save HTML Dashboard)
I get the error shown below:
Could not parse timestamp<1.487+12> using format defined by property.saveservice.timestamp+format=ms on sample 1.487+12 .........
I have also attached the screenshot of the error message kindly refer below:
Below is my saveservice properties that I copied into user properties file:
jmeter.save.saveservice.bytes = true
jmeter.save.saveservice.label = true
jmeter.save.saveservice.latency = true
jmeter.save.saveservice.response_code = true
jmeter.save.saveservice.response_message = true
jmeter.save.saveservice.successful = true
jmeter.save.saveservice.thread_counts = true
jmeter.save.saveservice.thread_name = true
jmeter.save.saveservice.time = true
jmeter.save.saveservice.print_field_names=true
# the timestamp format must include the time and should include the date.
# For example the default, which is milliseconds since the epoch:
jmeter.save.saveservice.timestamp_format = ms
# Or the following would also be suitable
#jmeter.save.saveservice.timestamp_format = dd/MM/yyyy HH:mm
#save service assertion
jmeter.save.saveservice.assertion_results_failure_message = true
I am not able to figure out the resaon, any help in this regard will be much appreciated.
please help, also please let me know if any addition information is required.
I have followed the below link to generate Dashboard:
http://jmeter.apache.org/usermanual/generating-dashboard.html

The answer is in your question itself:
Could not parse timestamp<1.487+12>
According to your configuration, JMeter expects first column to be in Unix timestamp format like 1487047932355 (time since beginning of Unix epoch in milliseconds)
Another supported format is yyyy/MM/dd HH:mm:ss.SSS like 2017/02/14 05:52:12.355
So there are several constraints:
The value of jmeter.save.saveservice.timestamp_format = ms should be the same during test execution and dashboard generation
You need to restart JMeter to pick the properties up. For example if you ran the test, then amended properties and then tried to generate dashboard - it might fail
There are no duplicate properties
You don't do anything with the .jtl results file between test execution and dashboard generation
My expectation is that you opened .jtl results file with MS Excel which converted timestamps into scientific notation and saved so most probably you will be able to do the opposite.
Just in case I would also recommend getting familiarised with Apache JMeter Properties Customization Guide

The default timestamp format in JMeter csv and logs is given in a Unix style format , but you can change it .
Go to (jmeterDirectory)/bin .
open jmeter.properties file .
Search for the following :-
jmeter.save.saveservice.timestamp_format
You will find it commented (Start with #) . Uncomment it and restart the Jmeter .
You can update this above property with the format you need

Related

Jmeter: How to create HTML dashboard in jmeter using saved summary csv file

I am using following command to generate HTML dashboard:
jmeter -g C:/Users/E01659/Desktop/feb28/feb28_10_3600.csv -o C:/Users/E01659/Downloads/apache-jmeter-5.1/bin/sonali/
Following error is coming: File
'C:\Users\E01659\Desktop\feb28\feb28_10_3600.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
errorlevel=1
From the error message, it is clear that - CSV file created earlier don't have the header as the first line. When you want to create the APDEX Dashboard from CSV file, JMeter expects that files are created with correct Save Service Configuration. You can change Result file config which are present in jmeter.propertes file.
You may need to change the line as below, so that file created has the headers name as required
jmeter.save.saveservice.label = true
The command you're using is correct, the reason of failure is mismatch of the .jtl file contents and what JMeter expects it to be.
If you got this feb28_10_3600.csv file from execution on another JMeter installation - make sure that JMeter's result save configuration on the machine where you're trying to generate the report is identical to the JMeter installation where JMeter was running.
Inspect the associated JMeter properties and amend them to for 100% match, once done you should be able to normally generate the dashboard.
If you still experience the differences update your question with first 2-3 lines of your .jtl results file.
You are receiving this error (most likely) due to a corrupt line at the end of your file. Just execute a 'tail ' to see the last few lines. Most likely, your last line is missing columns due to an abrupt stop in the test. Once you delete the problematic line, you should be able to generate the HTML report.

Jmeter Non GUI mode timestamp date format

I am using JMeter in Non-GUI mode and able to generate the .csv and .jtl files but the timestamp in the results file is in Epoch format and I want it to be in date (yyyy/MM/dd HH:mm:ss) format.
I did go to the /bin/user.properties file and made the necessary changes, but still the report looks same as before and has the timestamp in epoch format. This is what my user.properties looks like
jmeter.save.saveservice.bytes = true
# Only available with HttpClient4
#jmeter.save.saveservice.sent_bytes=true
jmeter.save.saveservice.label = true
jmeter.save.saveservice.latency = true
jmeter.save.saveservice.response_code = true
jmeter.save.saveservice.response_message = true
jmeter.save.saveservice.successful = true
jmeter.save.saveservice.thread_counts = true
jmeter.save.saveservice.thread_name = true
jmeter.save.saveservice.time = true
jmeter.save.saveservice.connect_time = true
# the timestamp format must include the time and should include the date.
# For example the default, which is milliseconds since the epoch:
#jmeter.save.saveservice.timestamp_format = ms
# Or the following would also be suitable
jmeter.save.saveservice.timestamp_format = yyyy/MM/dd HH:mm:ss
Double check your user.properties file, maybe you have a duplicate property somewhere and JMeter picks the one it finds first. Another assumption: try removing starting (and ending, if any) whitespace, maybe the property cannot be parsed as a valid SimpleDateFormat pattern, check jmeter.log file for any suspicious entries
As a workaround you can override the timestamp format via -J command-line argument like:
jmeter -Jjmeter.save.saveservice.timestamp_format="yyyy/MM/dd HH:mm:ss" -n -t example.jmx -l example.csv
Demo:
More information on working with JMeter Properties: Apache JMeter Properties Customization Guide

Jmeter beanshell script - Polish first and last name

i have a little problem with my jmeter test plan.
i have a jdbc request to extract customers in sql databases
from this sql query i retrieve first name and last name only
after that i have a beanshell little script to write all my customers in a csv file :
f = new FileOutputStream(vars.get("InputFilePath"));
p = new PrintStream(f);
nb_customer=Integer.parseInt(vars.get("NOM_#"));
for (i=1;i<=nb_customer;i++) {
p.println(vars.get("NOM_"+i) + ";" + vars.get("PRENOM_"+i));
}
p.close();
f.close();
my problem is that it is an application for our subsidiary company in polska
so, all customers first and last name are in polish language with different symbol, characters.
in the csv file, they appears with a ? in spite of the real character.
can you help me please ?
thanks a lot
Ludo
Try explicitly setting encoding to UTF-8, initialize PrintStream as:
p = new PrintStream(f, true, "UTF-8");
Check out JMeter default encoding as:
log.info(System.getProperty("file.encoding"));
If output is different from UTF-8 add the next line to system.properties file (lives under /bin folder of your JMeter installation:
file.encoding=UTF-8
and restart JMeter. Alternatively you can pass it via -D command line argument like:
jmeter -Dfile.encoding=UTF-8
See Apache JMeter Properties Customization Guide for more information on Jmeter properties and ways of setting and overriding them.
Check file contents in JMeter itself by using FileUtils.readFileToString() method like:

Saving a exact response in file in Jmeter

How to save exact response from Jmeter in a file?
e.g. - I have a response as email only so I want to save this email address only in a file with a success and failure but If I am saving a file as xml its giving a whole bunch of code otherwise if I save it as a csv file it's giving all sort of infomation other than a email address. Pls help me to solve it.
If you need to save the whole response - Save Responses to a file listener is what you're looking for.
If you need to store a part of the response - first of all get the necessary part with i.e. Regular Expression Extractor. Once you have JMeter Variable holding required value i.e. email you can add the next line to user.properties file (lives under /bin folder of your JMeter installation)
sample_variables=email
and ${email} variable value will be stored along with other results.
NB
you need to restart JMeter to pick the property up
you can also pass it via -J command line argument like:
jmeter -Jsample_variables=email -n -t /path/to/testplan.jmx -l /path/to/results.jtl
References:
Sample Variables
Apache JMeter Properties Customization Guide

How can we remove the current date from gradle generated .html and .xml file while running JMeter script from build.gradle file?

I am running my JMeter script from build.gradle file. After executing it is generating the html and xml report files with the script name. My problem is that current date is also present with the script name. Please tell me how to remove the current date from output files.
Gradle- gradle-2.4 version and HTML Report Publisher plugin in Jenkins
I'm assuming you're using com.github.kulya/jmeter-gradle-plugin ?
The date is tacked on to testplan name while generating results, which is then used while generating reports. The intention I believe is so that the results are not overwritten each time you run a test. The way it is currently implemented, it isn't configurable.
If you have only one set of result and report per jmx file, You should be able to define a new task though to strip out the date/timestamp from the results and report files.
task stripDateFromReport() {
new File("build/jmeter-report").eachFileMatch(~/.*.[xml|html]/){ file ->
def m = file.getName() =~ /^(.*?)-[0-9]{8}-[0-9]{4}(.*?)$/
file.renameTo(new File(file.getParentFile().getCanonicalPath()+ File.separator + m[0][1] + m[0][2]))
}
}
Note: If you have more than one report with just a different timestamp, this will obviously fail because once the dates are removed the filenames are not unique anymore.

Resources