{"id":1117,"date":"2017-02-28T15:02:32","date_gmt":"2017-02-28T15:02:32","guid":{"rendered":"https:\/\/loadfocus.com\/blog\/?p=1117"},"modified":"2026-08-29T20:07:28","modified_gmt":"2026-08-29T20:07:28","slug":"how-to-save-apache-jmeter-results-to-a-csv-file-or-xml-file","status":"publish","type":"post","link":"https:\/\/loadfocus.com\/blog\/2017\/02\/how-to-save-apache-jmeter-results-to-a-csv-file-or-xml-file","title":{"rendered":"How to Save Apache JMeter Results to a CSV file or XML file?"},"content":{"rendered":"<span class=\"span-reading-time rt-reading-time\" style=\"display: block;\"><span class=\"rt-label rt-prefix\"><\/span> <span class=\"rt-time\"> 3<\/span> <span class=\"rt-label rt-postfix\">minutes read<\/span><\/span><p class=\"lead\"><!-- pn-tldr --><\/p>\n<h2>Key takeaways<\/h2>\n<ul>\n<li>CSV is smaller and easier to analyse; XML keeps full detail you rarely need.<\/li>\n<li>Write results to file rather than a listener, which is what keeps large runs stable.<\/li>\n<li>Decide which fields you save up front, because you cannot recover what was not written.<\/li>\n<\/ul>\n<p><!-- \/pn-tldr -->Here are details on how to save or export the results of your Apache JMeter test script to a CSV or XML file.<\/p>\n<h3>Setup<\/h3>\n<p>1. Open Apache JMeter (here is how to <a href=\"https:\/\/loadfocus.com\/blog\/2014\/06\/24\/run-apache-jmeter-on-mac\/\">start Apache JMeter on Mac<\/a>) and right click<strong> Test Plan<\/strong> and <strong>Add -&gt; Threads (Users) -&gt; Thread Group<\/strong><br \/>\n2. Right click <strong>Thread Group<\/strong> and <strong>Add -&gt; Samplers -&gt; HTTP Request<\/strong><br \/>\n3. Add <strong>example.com<\/strong> to the Server input field of the <strong>HTTP Request<\/strong><br \/>\n4. Right click Thread Group and <strong>Add -&gt; Listeners -&gt; Aggregate Report<\/strong><\/p>\n<p>More details on <a href=\"https:\/\/loadfocus.com\/blog\/2016\/04\/13\/how-to-use-apache-jmeter-to-load-test-a-web-server\/\">how to load test a web server with Apache JMeter<\/a>.<\/p>\n<h3>Save Apache JMeter Results to a CSV file<\/h3>\n<p>1. Configure the filename in the <strong>Filename<\/strong> field of the <strong>Aggregate Report<\/strong><br \/>\ni.e.: <strong>[FULLPATH]\/results.csv<\/strong><br \/>\nwhere [FULLPATH] is the path on the disk to the directory where you want to save the Apache JMeter results.<br \/>\n2. Run the test script<br \/>\nResult<br \/>\nA file with the <strong>results.csv<\/strong> name should now be created at the path specified.<\/p>\n<h3>Save Apache JMeter Results to a XML file<\/h3>\n<p>1. Go in the <strong>Aggregate Report<\/strong> and click the <strong>Configure<\/strong> button<br \/>\n2. Check the <strong>Save as XML<\/strong> field in the top left corner.<br \/>\n3. Change the extension of the filename to XML i.e. <strong>[FULLPATH]\/results.xml<\/strong><\/p>\n<p>Result<br \/>\nA file with the results.xml name should now be created at the path specified.<\/p>\n<h3>Save results to current test script location<\/h3>\n<p>If you want to use the current test script location as the destination of your Apache JMeter test scripts, you can follow the below steps:<\/p>\n<p>1. Right click the <strong>Thread Group<\/strong> and <strong>Add -&gt; Config Element -&gt; User Defined Variables<\/strong><br \/>\n2. Add a new variable called <em>resultsfile<\/em> and for the value use the following:<\/p>\n<pre class=\"lang-js\"><code>For CSV: ${__property(user.dir)}${__BeanShell(File.separator,)}result.csv\nFor XML: ${__property(user.dir)}${__BeanShell(File.separator,)}result.xml\n<\/code><\/pre>\n<a href=\"https:\/\/d2woeiihr4s5r6.cloudfront.net\/blog\/jmeter-results.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/d2woeiihr4s5r6.cloudfront.net\/blog\/jmeter-results.png\" width=\"1196\" height=\"627\" \/><\/a>\n<p>(make sure the <strong>Save to XML<\/strong> is checkbox checked in the Aggregate Report)<\/p>\n<p>3. Go to the <strong>Aggregate Report<\/strong> and add the ${resultsfile} in the Filename field.<\/p>\n<p>Result<br \/>\nA file with the <em>results.csv<\/em> or <em>results.xml<\/em> name should now be created at the path specified.<\/p>\n<h3>Dynamic Filenames<\/h3>\n<p>In order not to overwrite the result values from the JMeter script, we can append a timestamp to the filename:<\/p>\n<pre class=\"lang-js\"><code>\nFor CSV: ${__property(user.dir)}${__BeanShell(File.separator,)}result_${__time(yyyyMMdd-HHmmss)}.csv\nFor XML: ${__property(user.dir)}${__BeanShell(File.separator,)}result_${__time(yyyyMMdd-HHmmss)}.xml\n<\/code><\/pre>\n<p>(make sure the <strong>Save to XML<\/strong> is checked in the <strong>Aggregate Report<\/strong>)<\/p>\n<p><strong>Apache JMeter note:<\/strong><br \/>\nDon&#8217;t use GUI mode for load testing, only for Test creation and Test debugging!<br \/>\nFor load testing, use NON GUI Mode &amp; adapt Java Heap to your test requirements<!-- pn-faq --><\/p>\n<h2>Frequently Asked Questions<\/h2>\n<h3>Should I save results as CSV or XML?<\/h3>\n<p>CSV in almost every case. It is far smaller and easier to analyse. XML keeps detail such as full response bodies, which is occasionally useful for debugging and expensive the rest of the time.<\/p>\n<h3>Why write to a file rather than use a listener?<\/h3>\n<p>Because listeners hold results in memory and are what makes long runs unstable. Writing to file is what lets a large test finish.<\/p>\n<h3>Can I add fields later?<\/h3>\n<p>No. You cannot recover what was never written, so decide which fields you save before a long run rather than after it.<\/p>\n<p><!-- \/pn-faq --><!-- pn-related-reading --><\/p>\n<h2>Related reading<\/h2>\n<ul>\n<li><a href=\"https:\/\/loadfocus.com\/blog\/2021\/12\/how-to-use-csv-data-set-to-configure-jmeter-tests\">How to Use CSV Data Set to Configure JMeter Tests<\/a><\/li>\n<li><a href=\"https:\/\/loadfocus.com\/blog\/2025\/05\/using-csv-data-in-jmeter-tests\">Using CSV Data in JMeter Tests<\/a><\/li>\n<li><a href=\"https:\/\/loadfocus.com\/blog\/2013\/07\/apache-jmeter-performance-test-introduction\">Introduction to Apache JMeter Performance Testing<\/a><\/li>\n<\/ul>\n<div class=\"custom-callout lf-jmeter-cta\">\n<p class=\"header-title\">Run this JMX in the cloud, from 25+ regions<\/p>\n<p>Upload your JMeter script to LoadFocus and run it with thousands of virtual users from 25+ cloud locations, with no load generators to manage. Results show p95\/p99 response times, throughput and errors per request, and a free tier is included.<\/p>\n<div class=\"buttons\">\n<div class=\"button1\"><a href=\"https:\/\/loadfocus.com\/jmeter-load-testing\" class=\"btn-primary\">JMeter Cloud Load Testing<\/a><\/div>\n<div class=\"button2\"><a href=\"https:\/\/loadfocus.com\/free-api-load-test\" class=\"btn-secondary\">Free API Load Test<\/a><\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p><span class=\"span-reading-time rt-reading-time\" style=\"display: block;\"><span class=\"rt-label rt-prefix\"><\/span> <span class=\"rt-time\"> 3<\/span> <span class=\"rt-label rt-postfix\">minutes read<\/span><\/span>Key takeaways CSV is smaller and easier to analyse; XML keeps full detail you rarely need. Write results to file rather than a listener, which is what keeps large runs stable. Decide which fields you save up front, because you cannot recover what was not written. Here are details on how to save or export&#8230;  <a href=\"https:\/\/loadfocus.com\/blog\/2017\/02\/how-to-save-apache-jmeter-results-to-a-csv-file-or-xml-file\" class=\"more-link\" title=\"Read How to Save Apache JMeter Results to a CSV file or XML file?\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":3699,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,48],"tags":[205,203,204],"class_list":["post-1117","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-apache-jmeter","category-test-automation","tag-save-aggregate-report-to-file","tag-save-jmeter-results-to-csv-file","tag-save-jmeter-results-to-xml-file"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/loadfocus.com\/blog\/wp-json\/wp\/v2\/posts\/1117","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/loadfocus.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/loadfocus.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/loadfocus.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/loadfocus.com\/blog\/wp-json\/wp\/v2\/comments?post=1117"}],"version-history":[{"count":3,"href":"https:\/\/loadfocus.com\/blog\/wp-json\/wp\/v2\/posts\/1117\/revisions"}],"predecessor-version":[{"id":3811,"href":"https:\/\/loadfocus.com\/blog\/wp-json\/wp\/v2\/posts\/1117\/revisions\/3811"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/loadfocus.com\/blog\/wp-json\/wp\/v2\/media\/3699"}],"wp:attachment":[{"href":"https:\/\/loadfocus.com\/blog\/wp-json\/wp\/v2\/media?parent=1117"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/loadfocus.com\/blog\/wp-json\/wp\/v2\/categories?post=1117"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/loadfocus.com\/blog\/wp-json\/wp\/v2\/tags?post=1117"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}