skip to content

Dynamic Values

Everything that makes the second iteration send different bytes from the first: values pulled out of responses, fed in from files, or computed by a function call.

on this pageshow

explore

questions

26

In JMeter's CSV Data Set Config, what happens if you leave Variable Names empty?

level: juniorimportance: must knowfreq 74%

answer

  1. Who names the columns here?
  2. One blank field changes everything
  3. Line one has two possible fates
  4. The ignore checkbox has a precondition

basics

~20 s

JMeter reads the file's first line and uses its fields as the variable names. That line is consumed as a header, never handed to a thread as data, and the Delimiter field must match the header's separator.

solid answer

~40 s

Leaving **Variable Names** empty tells JMeter's `CSV Data Set Config` to treat the file's first line as a header: it splits that line with the configured `Delimiter` and uses the resulting fields as JMeter variable names. The header is read once when the file is reserved, so no thread ever receives it as data. `Ignore first line` is consulted **only** when Variable Names is not empty — with an empty Variable Names field the first line must be the header, and ticking Ignore first line changes nothing. If the Delimiter does not match the header's separator, the entire line becomes one variable name and every `${USER}` reference is sent to the server literally instead of being replaced. Names are trimmed, so `USER, PASS` works.

code

csv · 4 lines
csv
USER,PASS
user00001,pw-8f3a
user00002,pw-11cd
user00003,pw-4b7e

go deeper

for a junior

Recall the two ways columns get names: type them into Variable Names, or leave it empty and let the file's first line be the header. Know that the header line is not sent as data.

for a middle

Explain that the header is read once when the file is reserved, that it is split with the Delimiter, and that Ignore first line is only consulted when Variable Names is non-empty.

for a senior

Show how a naming mistake presents in a real run: no error, an unresolved ${USER} in the request, or a BOM-prefixed column name when File encoding is set explicitly. Say how you would confirm it in one iteration.

for a principal

Own the convention: whether plans in your repo carry headers or typed names, and why one consistent choice removes a whole class of silent, per-plan data mismatches from review.

## Two ways to name the columns JMeter's **CSV Data Set Config** must learn a name for every column before it can put a row into thread variables, and the `Variable Names (comma-delimited)` field is the switch between the two ways it can do that. - **Field filled in** — the names you type are the names, matched to columns in file order. JMeter splits that field on **commas** whatever the `Delimiter` field is set to (the field's own label says so), and trims whitespace around each name, so `USER, PASS` is fine. - **Field empty** — JMeter reads the file's first line when it reserves the file, splits it with the configured **Delimiter**, and uses those fields as the variable names. That line is consumed at reserve time, so no thread ever receives it as data. Either way the element writes one row into the thread's variables at the start of each iteration, so `${USER}` in a sampler resolves to whatever row that thread currently holds. ## What "Ignore first line" actually controls The checkbox's own label in JMeter 6.0.0 is the whole rule: **Ignore first line (only used if Variable Names is not empty)**. It exists for the case where you want to name the columns yourself but the file still carries a header row you must not send as data. | Variable Names | Ignore first line | What happens to line 1 | |---|---|---| | `USER,PASS` | unticked | treated as data — the first thread to iterate logs in as `USER` / `PASS` | | `USER,PASS` | ticked | skipped; the names are the ones you typed | | empty | unticked | read as the header; it supplies the names | | empty | ticked | read as the header anyway; the tick changes nothing | The bottom row is the one candidates get wrong. With Variable Names empty the first line **must** be the header, and ticking the box does not make JMeter skip a second line as well. ## Where a 10,000-row credential file goes wrong - **Delimiter mismatch.** Set `Delimiter` to `,` on a tab-separated file and the whole header becomes a single variable name. Nothing errors; `${USER}` is simply never defined, and the sampler sends the eight characters `${USER}` to the server as the username. - **A byte order mark.** JMeter strips a BOM only when `File encoding` is left empty. Name an encoding explicitly and the BOM stays, so the first header field becomes an invisible-prefixed name that no `${...}` reference will ever match. - **An empty file.** With Variable Names empty there is no header to read, and the element fails at startup with `Could not read file header line for file ...` rather than running with no data. - **Recycling.** When the header mechanism is in play, JMeter skips the first line again every time it reopens the file, so a recycled run does not suddenly hand a thread the header row. ## Checking it in under a minute 1. Open the file's first line and count the separators; set `Delimiter` to match (`\t` for a tab). 2. Decide who names the columns and use exactly one mechanism — typed names, or an empty field plus a header. 3. Tick `Ignore first line` only when you typed names **and** the file really carries a header. 4. Run a single thread for one iteration and look at what the sampler actually sent; an unresolved `${USER}` in the request is the fastest possible confirmation that the naming is wrong.

  • When does the Ignore first line checkbox actually take effect in a CSV Data Set Config?
    Only when Variable Names is non-empty. It exists so you can name the columns yourself on a file that still carries a header row. With Variable Names empty the first line is the header by definition, and ticking the box does not skip an additional line.
  • If Recycle on EOF is on, does the header line get handed out as data on the second pass?
    No. When the header mechanism is active, JMeter reopens the file and discards the first line again before reading, so every pass through the file starts at the first data row.
  • What does JMeter do if the file you point Filename at is empty?
    With Variable Names empty there is no header to read, so the element fails at startup with 'Could not read file header line for file ...' rather than running with no variables defined.

saying these in an interview costs you the question

  • Says Ignore first line skips the header when Variable Names is empty.
  • Assumes the header row is also handed to the first thread as data.
  • Thinks the Variable Names field is split by the Delimiter rather than by commas.
  • Believes an empty Variable Names field means the columns get no names at all.
  • Expects a Delimiter mismatch to raise an error instead of failing silently.
open as a page

In JMeter, how do you write a call to a built-in function such as __UUID?

level: juniorimportance: must knowfreq 78%

basics

~10 s

JMeter function calls take the form ${__functionName(arg1,arg2)}. The double underscore marks a built-in, the parentheses hold comma-separated positional arguments, and a function that takes none may drop them: ${__UUID}.

open as a page

In JMeter's Regular Expression Extractor, what does a Template value of $1$ refer to?

level: juniorimportance: must knowfreq 76%

basics

~20 s

Template $1$ inserts the text captured by the first parenthesised group of the Regular Expression field. JMeter builds the stored value from the Template, so $0$ means the whole match and $1$ the first group.

open as a page

In Apache JMeter, how do you capture an order id from a JSON confirmation body for the next request?

level: juniorimportance: must knowfreq 74%

basics

~20 s

Add a JSON Extractor as a child of the sampler that returns the confirmation body, give it a variable name and a JSON Path expression, then reference the captured value as ${orderId} in the next request.

open as a page

In JMeter, what is the difference in scope between a variable and a property?

level: juniorimportance: must knowfreq 85%

basics

~10 s

A JMeter variable is a per-thread copy that no other thread can read or change. A JMeter property is a single JVM-wide value that every thread in the run shares.

open as a page

How does JMeter's CSV Data Set Config behave when it reaches the end of the file?

level: middleimportance: must knowfreq 78%

basics

~20 s

Two checkboxes decide. Recycle on EOF, ticked by default, reopens the file at line one. With Recycle off and Stop thread on EOF off, every variable becomes <EOF>. With Recycle off and Stop thread on, the thread stops.

open as a page

In JMeter, what happens when a function argument contains an unescaped comma?

level: middleimportance: must knowfreq 62%

basics

~20 s

JMeter splits a function's argument list at every unescaped comma, so the comma becomes an extra argument. Write it as a backslash followed by a comma to keep it inside one argument; otherwise the call fails its parameter-count check.

open as a page

When would you reach for JMeter's Boundary Extractor instead of its Regular Expression Extractor?

level: middleimportance: must knowfreq 66%

basics

~20 s

Reach for the Boundary Extractor when the value sits between two stable literal strings. Its Left Boundary and Right Boundary fields are matched as plain substrings, so nothing has to be escaped and the element stays readable.

open as a page

In JMeter's JSON Extractor, what has to match when you extract two values at once?

level: middleimportance: must knowfreq 58%

basics

~10 s

The counts must match. JMeter splits Names of created variables, JSON Path expressions and Default Values on semicolons and rejects the element when those three lists come out different lengths.

open as a page

Which property files does JMeter load at startup, and in what order?

level: middleimportance: must knowfreq 60%

basics

~10 s

JMeter loads bin/jmeter.properties first, then the file named by its user.properties key, whose entries override it, then the file named by its system.properties key, which updates the JVM's system properties instead.

open as a page

In a JMeter run, why can a Regular Expression Extractor's variable still hold the previous iteration's value?

level: seniorimportance: must knowfreq 57%

basics

~20 s

Because JMeter only writes the Default Value when that field is non-empty or Use empty default value is ticked. With both left alone, a failed match writes nothing and the variable keeps whatever the last successful match put there.

open as a page

A password in your JMeter CSV Data Set Config file contains the delimiter. What happens?

level: middleimportance: should knowfreq 52%

basics

~20 s

The row splits into an extra field unless Allow quoted data is ticked and the value is wrapped in double quotes. Without it, later variables take the wrong fragments, and a variable the row cannot fill keeps its previous value.

open as a page

In JMeter, ${A${N}} does not resolve. How do you look up a variable whose name is built at run time?

level: middleimportance: should knowfreq 48%

basics

~10 s

JMeter has no nested-variable syntax. Wrap the composed name in the __V function instead: ${__V(A${N})} evaluates A${N} to A1 first, then returns the value of the variable called A1.

open as a page

In JMeter's Regular Expression Extractor, what does a negative Match No. change about the variables written?

level: middleimportance: should knowfreq 49%

basics

~10 s

A negative Match No. tells JMeter to process every occurrence. It writes refName_matchNr with the count and refName_1, refName_2 and so on for each hit, while refName itself keeps the Default Value.

open as a page

In JMeter, what does the XPath Extractor offer that the XPath2 Extractor does not?

level: middleimportance: should knowfreq 38%

basics

~20 s

The Tidy option set. Only the older XPath Extractor can run a malformed HTML body through Tidy first, along with the DTD, namespace and whitespace toggles that go with its parser. The XPath2 Extractor has none of them.

open as a page

In JMeter, what does ${__P(base.url)} return when base.url is not set?

level: middleimportance: should knowfreq 45%

basics

~10 s

The literal string 1. JMeter's __P function uses 1 as its built-in default when no second argument is given, so an unset property silently resolves to 1 rather than raising an error.

open as a page

A JMeter CSV Data Set Config feeds 200 threads the same few rows. What went wrong?

level: seniorimportance: should knowfreq 58%

basics

~20 s

Sharing mode is set to Current thread, which opens a separate reader per thread, each starting at line one. Only All threads, the default, gives one shared file pointer so no two threads take the same line.

open as a page

In a JMeter HTTP Request's Body Data field, how do you generate a unique order id per request?

level: seniorimportance: should knowfreq 54%

basics

~20 s

Put the function in the Body Data field itself. ${__UUID} yields a fresh type-4 UUID on every evaluation; ${__counter(TRUE,)} yields a per-thread sequence; ${__threadNum} is fixed per thread and only unique inside its own Thread Group.

open as a page

A JMeter JSON Extractor with Match No. -1 found the order id, yet ${orderId} renders literally. Why?

level: seniorimportance: should knowfreq 46%

basics

~10 s

Match No. -1 makes the JSON Extractor write orderId_1, orderId_2 and orderId_matchNr, never the bare orderId. A literal ${orderId} downstream is the signal that extraction succeeded, not that it failed.

open as a page

In JMeter, how do you make a value captured by one thread readable by all threads?

level: seniorimportance: should knowfreq 40%

basics

~10 s

Write it into the property map with ${__setProperty(name,value)} and read it anywhere with ${__P(name)}. Variables cannot cross threads, because every thread holds its own private copy.

open as a page

Why can a value set in JMeter's system.properties be invisible to ${__P(...)}?

level: seniorimportance: should knowfreq 30%

basics

~10 s

Because system.properties updates the JVM's system properties, which JMeter consults only as a fallback. Any key already present in jmeter.properties or user.properties shadows it, so the last file loaded still loses.

open as a page

What does JMeter's Function Helper Dialog give you when you click Generate?

level: juniorimportance: nice to knowfreq 24%

basics

~10 s

Generate builds the ${__function(...)} call string from the argument boxes you filled in, escapes commas outside a nested reference, copies the result to the clipboard, and runs the call once for a preview.

open as a page

What changes in JMeter's Counter when Track counter independently for each user is ticked?

level: middleimportance: nice to knowfreq 22%

basics

~10 s

Ticked, every thread counts its own private sequence from the start value. Unticked, all threads advance one shared synchronized sequence, so each iteration anywhere in the run takes the next distinct number.

open as a page

In JMeter, why can two CSV Data Set Config elements naming one file consume it twice?

level: seniorimportance: nice to knowfreq 26%

basics

~20 s

JMeter keys the open file by the Filename string plus the Sharing mode suffix, not by the resolved file on disk. So logins.csv and ./logins.csv are two keys, and each gets its own reader starting at line one.

open as a page

Which JMeter property switches the Regular Expression Extractor off the Jakarta ORO engine?

level: seniorimportance: nice to knowfreq 16%

basics

~10 s

The property is jmeter.regex.engine. It defaults to oro, and setting it to any other value makes the Regular Expression Extractor compile its pattern with the JDK engine instead.

open as a page

In JMeter, does one JSON Extractor with three expressions parse the response body only once?

level: seniorimportance: nice to knowfreq 26%

basics

~10 s

No. JMeter's JSON Extractor loops over its semicolon-separated expressions and hands the response string to the JSON reader once per expression, so three expressions mean three parses of the same body.

open as a page