January 7, 2014

How to write variable values in JMeter?

Sample Test Plan

In this blog post, we will see how to write variable values in JMeter. Writing run-time variable value helps you for debugging your test plan.

Go to JMETER_HOME\bin, open file in your favorite editor. (I use jEdit or Notepad++). Search for sample_variables text.

By default it is commented, uncomment that line. You could see there will two default variables SESSION_ID,REFERENCE. You can remove those variables or you can keep it as it is.

Now add your variable names separated by comma. E.g. sample_variables=SESSION_ID,REFERENCE,myval1,myval2,myval3, … and so on.

Now add a Simple Data Writer listener and enter a valid CSV file name. JMeter writes the values of the variables in that file in run-time.

Below is the snapshot of my test plan and the output.

Sample Test Plan

Sample Test Plan

CSV Output

CSV Output

Download my sample test plan

Sign up for our free newsletter!

About NaveenKumar Namachivayam

Hi there! is a passionate and experienced Performance Test Analyst based in Chicago, USA with skill sets in Manual Testing, Test Automation, Performance Testing, and Test Estimation. He loves to learn and experiment new trends and models in Software Testing. Please stop by at his personal blogs: Excel Blog, DealsBrook,, and Affiliate Insights blog and Software Testing Memes.

Leave a Reply

Your email address will not be published. Required fields are marked *