Configure CSV Data Files in JMeter

How JMeter's CSV Data Set Config reads CSV and TSV files into test variables, which settings matter, and where delimiters, quoting and encoding cause problems.

Apache JMeter can feed a load test with values from a delimited text file, so each virtual user logs in with different credentials, searches for different terms or submits different form data. The standard way to do this is the CSV Data Set Config element. This review covers what that element does to your data, which settings decide whether it behaves as expected, and where the file format itself causes trouble. No version-specific test results were available for this article, so the behavior described here follows JMeter's documented design. Check details against the documentation for the release you run.

Is a CSV data file the right approach for your test?

A CSV data file is a good fit when a test needs many distinct input values and you want to change those values without editing the test plan. Its main benefit is separation: the test logic stays in the plan and the data stays in a plain-text file that you can regenerate, review in version control or swap between environments.

The main tradeoff is that the file becomes part of the test's runtime setup. The file has to exist at the expected path on every machine that runs the test. Its delimiter, quoting and encoding have to match the element's settings. Its row count also interacts with thread count, iteration count and the end-of-file options. If any of these drift, the test can send the wrong values or a placeholder string without failing in an obvious way.

Hard-coded values or User Defined Variables are often simpler when every thread can use the same value, when there are only a handful of values, or when the data is generated on the fly by a JMeter function such as a random or counter function. JMeter also offers functions like __CSVRead and __StringFromFile for narrower cases. For most per-user test data, though, CSV Data Set Config is the usual choice.

What the CSV Data Set Config actually does

The element does not modify your file. At runtime it reads one line per iteration, splits that line on the configured delimiter, and assigns each piece to a named JMeter variable. Samplers and other elements then reference those values with the ${name} syntax. The transformation exists only in memory during the test, and the file on disk is unchanged.

This distinction matters when you prepare the file in a spreadsheet. A spreadsheet shows a grid, but JMeter reads the characters actually saved in the file. Cell formatting, hidden columns, number display and date display do not carry over. Only the exported text does. A value that looks like 0123 in a spreadsheet may have been saved as 123. A date may be saved in a regional format your application rejects.

A minimal example uses this file:

username,password
alice,secret1
bob,secret2
carol,secret3

Set Variable Names to username,password and enable Ignore first line, or leave Variable Names empty so JMeter takes the names from the header row. A sampler can then reference the values like this:

POST /login
user=${username}&pass=${password}

On each iteration, a thread receives the next unread row. With the default sharing mode, all threads draw from one shared position in the file. Three threads running one iteration each would therefore typically get alice, bob and carol, although the order in which threads claim rows is not guaranteed.

Key settings and what they control

Setting | What it controls | Common pitfall
Filename | Path to the data file; relative paths resolve against the location of the test plan | The path works on your workstation but not on a load generator or CI agent
File encoding | Character encoding used to read the file; the platform default applies if left blank | Non-ASCII names or accented characters come through garbled
Variable Names | Comma-separated list of variable names in column order; if empty, the first line of the file supplies the names | Names do not match the ${...} references in samplers
Ignore first line | Skips a header row; only relevant when Variable Names is filled in | The header row is sent as test data
Delimiter | Character that separates fields; use \t for tab-separated files | The file was exported with semicolons but the element expects commas
Allow quoted data? | Treats double-quoted fields as single values, so delimiters inside quotes are kept | A comma inside an address or description splits one field into two
Recycle on EOF? | Restarts from the top of the file after the last row | Rows are reused when uniqueness was required
Stop thread on EOF? | Stops the thread when the file runs out (when recycling is off) | The test ends earlier than the configured duration
Sharing mode | Whether all threads, one thread group or each thread individually read through the file | Every thread receives the same first row because each thread has its own copy

When both Recycle on EOF and Stop thread on EOF are off, threads that read past the last row receive the placeholder value <EOF> rather than real data. Requests then go out with that literal text. This is a frequent cause of unexplained errors late in a test run, so decide on end-of-file behavior deliberately. Base that decision on how many rows you have relative to threads multiplied by iterations.

CSV versus TSV

JMeter does not require a comma. Tab-separated files work when the delimiter is set to \t. Choosing tabs can reduce quoting problems when your values often contain commas, such as addresses, free-text comments or numbers formatted with thousands separators. The cost is that tabs are invisible in many editors. A stray space typed where a tab should be is hard to spot.

Some spreadsheet applications export CSV with a semicolon delimiter in locales where the comma is the decimal separator. If your values split in the wrong places, open the exported file in a plain-text editor and check which character actually separates the fields before changing anything in JMeter.

Will the data survive copying, exporting and sharing?

CSV and TSV are plain text, so they copy, diff and version-control cleanly. Problems usually come from the tools that create or edit the files, not from the format itself. These points are worth checking whenever a file moves between people, editors or machines:

  • Encoding: save the file in a known encoding, commonly UTF-8, and set the same value in File encoding instead of relying on each machine's platform default.
  • Byte order mark: some editors add an invisible marker at the start of UTF-8 files. Depending on the JMeter version, it may end up attached to the first value or the first header-derived variable name. If the first column misbehaves while the others work, check for this.
  • Line endings: files edited on different operating systems can mix line-ending styles. Mixed endings rarely cause visible errors but can leave stray characters at the end of the last field in a row.
  • Whitespace: spaces around delimiters may be kept as part of the value. Trim them in the source file rather than assuming JMeter will.
  • Embedded delimiters and quotes: if a value contains the delimiter, quote the value and enable Allow quoted data. Inside a quoted value, represent a literal double quote by doubling it.
  • Distributed runs: in remote or distributed testing, each load generator reads its own local copy of the file. Copy the file to every node at the expected path. Expect each node to read independently, so rows may be reused across nodes unless you split the data yourself.

Accessibility and screen-reader concerns that apply to styled or mirrored text do not really apply here. The file is input data for a test tool, not content for human readers. The practical usability question is whether another tester can open the file in a plain-text editor and understand it. Clear header names, one consistent delimiter and no spreadsheet-only formatting keep it readable.

Recommendation

Use CSV Data Set Config when a test needs varied, per-thread input that should live outside the test plan. Treat the data file as a test asset. Fix its encoding and delimiter, keep a header row, and size it against the number of threads and iterations. Then choose the end-of-file behavior on purpose rather than accepting the default. Verify a small dry run with a results listener or debug sampler before a full run, because misread data often produces plausible-looking requests instead of clear failures. Fall back to plain hard-coded values or User Defined Variables when every thread can share the same data, or when the setup cost of maintaining a file outweighs the benefit.

Gaps to note: this article does not include measured performance figures, version-by-version behavior differences or tested results from specific spreadsheet exporters. Confirm those points against your JMeter version's documentation and a short trial run in your own environment.