jmeter How to merge two JTL files?

  • perf-test.com need your contributions to build up a strong repository of performance engineering resources.

amitbose

Member
Aug 13, 2014
39
8
8
I want to merge two jtl files inorder to generate graph, I have used two LG's for executig the test and now I want to generate a single result graph/report.

I am sure this can be done.
 
Merging JTL files
If multiple tests are run using the same output file name, then JMeter automatically appends new data to the end of the file.

However, there may be occasions when you want to combine multiple files: for example if a test was run in non-GUI mode on multiple hosts, each host will generate its own file.

Note that currently the JTL files don't include details of the hostname where the test was run. The hostname can be included in sample labels by using the machineName() function.

If you need to distinguish the different samples after merging, you could pre-process the files to add a marker to each sample label.


Merging CSV format files
This can only be done if the same field (column) settings were used for each file.

The files can be concatenated.

This will probably result in multiple header lines. The duplicates need to be removed, and the remaining header line moved to the start of the file if necessary.

Depending on how you intend to use the merged file, it may be necessary to sort the resulting file using the timestamp.

Note that even a single JTL may contain entries where the timestamps are out of order. This is because the timestamps (by default) are start times, whereas the samples are generated in order of end times.



Merging XML format files
These have the format:


<?xml version="1.0" encoding="UTF-8"?>
<testResults version="1.2">
<sample ... />
...
<sample ... />
</testResults>
The files can be concatenated, and the additional embedded trailers and headers removed.

It's probably possible to automate this with suitable XSL files (contributions welcome).

Likewise, the contents can probaby be sorted if necessary using XSLT.