Parameterisation, CSV Data and Correlations

Hard-coding test data in JMeter scripts leads to brittle plans that are difficult to reuse across environments or scenarios. Parameterisation with variables, CSV data and correlation makes your tests more flexible and realistic.

Using Variables, CSV Data and Correlation

JMeter lets you define user variables and read values from CSV files so each thread can use different inputs, such as user credentials or product IDs. Correlation refers to capturing values from one response (like session IDs or tokens) and reusing them in subsequent requests.

Example techniques:
- CSV Data Set Config: reads usernames/passwords from a file
- User Defined Variables: store base URLs or common parameters
- Regular Expression Extractor: capture a token from a response
- JMeter functions: ${__Random(1,1000)} for random numbers
Note: Proper correlation is often the difference between a script that works once and a plan that can simulate many realistic sessions.
Tip: Keep CSV files under version control and document their structure so others can regenerate or update them when needed.
Warning: Forgetting to parameterise unique fields (such as emails or order IDs) can cause collisions and unrealistic errors under load.

With parameterisation and correlation in place, each virtual user behaves more like a real user rather than repeating the same static sequence.

Common Mistakes

Mistake 1 โ€” Using the same credentials and IDs for all threads

This creates unrealistic contention.

โŒ Wrong: Every thread logging in as the same user and updating the same records.

โœ… Correct: Use CSV or factories so threads represent distinct users or sessions where appropriate.

Mistake 2 โ€” Ignoring dynamic values like tokens

This breaks flows.

โŒ Wrong: Hard-coding tokens or assuming they never change.

โœ… Correct: Extract dynamic values from responses and feed them into later requests.

🧠 Test Yourself

What is the main benefit of parameterisation and correlation in JMeter?