Feather Background Waves Background
Skip to main content
Feather Background Waves Background
Feather Background Waves Background
  1. JMeter in English/

JTL Result File in CSV or XML Format

Table of Contents
Beginner - This article is part of a series.
Part 11: This Article

resultados

The best way to run a load test in JMeter is through the non-graphical mode, although it is better known as CLI (command line interface) or command line. There are two main files: the JMeter log file and the results file JTL, but they must be specified with the options -l for the JTL and -j for the log file. Today we focus on the JTL or result file. By definition, this file is in CSV (comma separated values) or comma-separated-value format, and its importance lies in that it contains all details and results of each request, transaction, or tag defined in the JMeter script.

Unix/Linux/Mac

jmeter.sh  -n -t script.jmx -l resultados.jtl -j bitacora.log

Windows

jmeter.bat -n -t script.jmx -l resultados.jtl -j bitacora.log

Here is an example of what a JTL file looks like in CSV format:

jtl

This format has the following advantages:

  • It is lightweight. (takes up little space on disk)
  • It is easy to read as plain text (practically any text editor)
  • It is easy to import and graph data.
  • It is simple error detection.

This format is the most popular because it is defined, but has the major limitation that we cannot store requests and their responses as part of the result. Normally this information should not be stored in case of being successful, since it occupies space and resources, but could be necessary for some type of post-mortem or debugging analysis. If you require storing this type of information, I suggest reading this publication “Debugging errors during execution” but instead of storing it as part of the result file, it is sent to the log. To store the details of requests first we have to change the format of the results file to XML, which can be achieved by replacing the property in the command line or permanently modifying the jmeter.properties file.

-Jjmeter.save.saveservice.output_format=xml

after we enable storage of details, with the following property

-Jjmeter.save.saveservice.response_data=true

Here is an example of replacing lines by command line:

Unix/Linux/Mac

jmeter.sh  -n -t script.jmx -l resultados.jtl -j bitacora.log -Jjmeter.save.saveservice.output_format=xml -Jjmeter.save.saveservice.response_data=true

Windows

jmeter.bat -n -t script.jmx -l resultados.jtl -j bitacora.log -Jjmeter.save.saveservice.output_format=xml -Jjmeter.save.saveservice.response_data=true

Which would result in an output file like this:

<?xml version="1.0" encoding="UTF-8"?>
<testResults version="1.2">
<sample t="165" it="0" lt="11" ct="1" ts="1675066304203" s="true" lb="HTTP Sampler" rc="200" rm="OK" tn="Thread Group 1-1" dt="text" by="36" sby="0" ng="1" na="1">
 <responseData class="java.lang.String">9634dd0f-d8b7-41d1-9c52-685f9765d4fb</responseData>
</sample>
<sample t="485" it="0" lt="21" ct="3" ts="1675066304807" s="true" lb="HTTP Sampler" rc="200" rm="OK" tn="Thread Group 1-1" dt="text" by="36" sby="0" ng="1" na="1">
 <responseData class="java.lang.String">5215d3bc-38ca-479b-82af-0a042ebaafe8</responseData>
</sample>
<sample t="194" it="0" lt="48" ct="3" ts="1675066305315" s="true" lb="HTTP Sampler" rc="200" rm="OK" tn="Thread Group 1-2" dt="text" by="36" sby="0" ng="2" na="2">
 <responseData class="java.lang.String">b9bca1f2-5ee5-41d1-8d8f-5cf11243f8d6</responseData>
</sample>
Conclusion>

Conclusion #

It should be noted that this will only serve you during execution. If you want this behavior to persist permanently, you will need to modify the jmeter.properties file in your project directory. Additionally, I recommend visiting this link: URL and modifying the properties as needed in the jmeter.properties file according to my previous advice. Alternatively, if you are performing a load testing and only want to save the information of failed tags, you can do so with the option:

jmeter.save.saveservice.response_data.on_error=true


Beginner - This article is part of a series.
Part 11: This Article