{__time(DD-MM-YYYY)} is used to save Jmeter results, date is returning like 32-03-2019,33-03-2019, etc - jmeter

I have used {__time(DD-MM-YYYY)} to save Jmeter results, results are saving successfully but date is returning like 32-03-2019, 33-03-2019, etc

According to docs you should use pattern for SimpleDateFormat:
D - Day in year
d - Day in month
Note also that
y - Year
Y - Week year
so you propably want to use dd-MM-yyyy

Most probably you're going into wrong direction. If you're using this function in the Listener - you should reconsider your approach as Listeners don't add any value, listeners just consume a lot of resources and being evaluated after each sampler
You should be running your tests in command-line non-GUI mode like:
jmeter -n -t test.jmx -l result.jtl
if you need to customise the result.jtl file to add a timestamp to it - go for command-line interpreter of your operating system features.
For example on Windows it would be something like:
jmeter -n -t test.jmx -l %date:~7,2%-%date:~4,2%-%date:~10,4%-result.jtl
on Linux/Unix/MacOS (given Bash shell)
./jmeter -n -t test.jmx -l `date +%d-%m-%Y-result.jtl

Related

JMeter - Summary Report not displaying correctly

I am new to JMeter so bear with me...
I have a setUp Thread Group where I am grabbing a token and then re-using that in the HTTP Header Manager within the main Thread Group. Within that Thread Group I have the following parameters set...
I run this command to execute the tests:
jmeter -n -t PSC_Token.jmx -l testPsc.jtl -f
When I open the testPsc.jtl file though in Summary Report, I would expect that each request would show 600 for # Samples (200 threads * 3 loop count) but it is showing 1200 for each.
I tried deleting the file entirely and re-running it, just in case it was appending or something strange. That doesn't resolve the issue though.
Any ideas?
You're writing the same data into the same file 2 times, the options are in:
Disable (or better delete) the Summary Report listener, in general Listeners don't add any value, they only consume resources
Or remove -l command line argument and run your test just like:
jmeter -n -t PSC_Token.jmx
Also be aware that according to JMeter Best Practices you should always be using the latest version of JMeter so consider upgrading to JMeter 5.5 (or whatever is the latest stable version available at JMeter Downloads page)

JMeter MergeResults is not handling timeStamp label correctly (millis)

Created two dummy sample projects as (dummy1.jmx and dummy2.jmx) and executed below commands with default settings (JMeter 5.3 default installation with all required plugins installed).
#> jmeter.bat -n -t dummy1.jmx -l dummy1.csv -j dummy1-jmeter.log to execute load
Generated report and timestamps look perfect both in dashboard and graphs
**#> jmeter.bat -g dummy1.csv -o dummy1 -j dummy1-report-jmeter.
#> jmeter.bat -n -t dummy2.jmx -l dummy2.csv -j dummy2-jmeter.log to execute load
Generated report and timestamps look perfect both in dashboard and graphs
#> jmeter.bat -g dummy2.csv -o dummy2 -j dummy2-report-jmeter.log
Used MergeResults plugin to merge the above CSV files to a single file and generated HTML report
#> JMeterPluginsCMD.bat --generate-csv dummy1-dummy2.csv --input-jtl merge.properties --plugin-type MergeResults
Found merged timeStamp label is not valid and also generated report shows invalid DateTime.
#> jmeter.bat -g dummy1-dummy2.csv -o merged -j merged-report-jmeter.log
Is this a bug or am I missing configuration? Even adding jmeter.save.saveservice.timestamp_format=yyyy/MM/dd HH:mm:ss.SSS to user.properties didn't help
merge.properties
inputJtl1=dummy1.csv
prefixLabel1=TEST1:
includeLabels1=.*
excludeLabelsl=
includeLabelRegex1=true
excludeLabelRegex1=
startOffset1=
endOffset1=
inputJtl2=dummy2.csv
prefixLabel2=TEST2:
includeLabels2=.*
excludeLabels2=
includeLabelRegex2=true
excludeLabelRegex2=
startOffset2=
endOffset2=
Unfortunately we cannot help without:
Seeing your merge.properties file contents
Knowing what do you expect
In the meantime I can only tell you where did this 2000-01-01 date came from:
It's declared here:
private static final long REF_START_TIME = 946681200000L;
And being added to the original SampleResult timestamp here:
res.setTimeStamp(res.getTimeStamp() - startTimeRef + REF_START_TIME);
I don't know whether it is a bug or it's designed to work like this (however the crazy logic of substraction of sampler start time from its timestamp is beyond my limited understanding), it's better to check at JMeter Plugins support forum
In the meantime you can use services like BM.Sense for comparing different test runs resutls

How to get the result csv file in between the test run during performance testing using Jmeter?

I am using Jmeter Version 4. For example I am running test for four hours, And during the test run, I want the result file for the test ran from 2nd to 3rd hour.Is it possible to get the result file like that?
I know that we can get the result file from starting to 3rd hour.But I want from 2nd to 3rd hour.
Can I get that.Please suggest?
The easiest option is going for Filter Results Tool which has --start-offset and --end-offset parameters specifying how to "cut" the original .jtl file (in seconds) so you could do something like:
FilterResults --output-file from2ndto3rd_hour.jtl --input-file /path/to/large/result.jtl --start-offset 7200 --end-offset 10800
Filter Results Tool can be installed using JMeter Plugins Manager:
Ideally, you should use this solution that allows you to have live results:
https://jmeter.apache.org/usermanual/realtime-results.html
But if you want to work with CSV, your best bet would be to modify the timestamp format by adding to user.properties :
jmeter.save.saveservice.timestamp_format=yyyyMMddHHmmss
And ensure JMeter flushes on every write to avoid having partial lines:
jmeter.save.saveservice.autoflush=true
And then use grep, for example to take results between 15 and 16h on 26 january 2019
grep "2019012615" results.csv > filter.csv
If you don't want to rely on grep, then you can take the whole file and generate the HTML report using :
jmeter -Jjmeter.reportgenerator.start_date=20190126150000 -Jjmeter.reportgenerator.end_date=20190126160000 -g results.csv -o reportfolder

How to generate the total time required for the entire test plan in Jmeter

I have an aggregate report:
Do I have to add another listener or add anything else to the testplan?
For ex: consider the above snapshot:
I'm running 9002 samples, I just need to know the total time required for all the 9002 samples?
If your 9002 Samples are played in a sequence by only 1 user, just use a TransactionController that will contain your HTTP Request and you will have this.
If 9002 samples are played by different users then you can export the CSV file that contains the test results and use Excel to sum up the elapsed column.
To generate a CSV file, run test in NON GUI Mode using:
jmeter -n -l results.csv -t test.jmx

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