Execution Reference · Apache JMeter

JMeter Test Elements Execution Order

JMeter executes test elements in a specific sequence during runtime. Understanding this flow is critical for building reliable, well-structured test scripts.

Debugging Scripts Correlation Handling Dynamic Parameterization Throughput Control
⭐ Execution Flow — Left to Right
Test Plan
Config Elements
Thread Group
Pre-Processors
Timers
Samplers
Post-Processors
Assertions
Listeners
01

Test Plan

Root Container📐
The top-most container in JMeter — the master blueprint of the entire performance test. Defines test structure, variables, user-defined properties, execution settings, and all child elements.
Structure
Test Plan
├── User Defined Variables
├── Thread Group
├── HTTP Request Defaults
└── Listener
02

Configuration Elements

Before Requests⚙️
Provide default settings, shared configurations, and dynamic test data. Processed before any requests are executed.
Config ElementPurpose
HTTP Request DefaultsDefault server / domain / protocol
CSV Data Set ConfigExternal test data
HTTP Cookie ManagerSession handling
HTTP Header ManagerAPI headers
JDBC Connection ConfigDB connection
User Defined VariablesGlobal variables
Example
HTTP Request Defaults
Server = demo.guru99.com
Protocol = https
03

Thread Group

Load Generator👥
The heart of load generation. Controls virtual users, ramp-up period, iterations, and test duration.
ParameterMeaning
ThreadsNumber of virtual users
Ramp-upTime to start all users
Loop CountNumber of iterations
Example
100 Users · Ramp-up = 50 sec · Loop = 5
→ 2 users/sec added, each repeats 5×
04

Pre-Processors

Before Sampler🔧
Execute before the sampler/request. Used for dynamic data preparation, request modification, token generation, encryption, and custom scripting.
Pre-ProcessorPurpose
User ParametersDynamic user data
JSR223 PreProcessorGroovy scripting
BeanShell PreProcessorCustom logic
Example — Dynamic Timestamp
vars.put("timestamp", System.currentTimeMillis().toString())
05

Timers

Before Sampler⏱️
Add delay before requests to simulate human think time, pacing, and real user behavior. Without timers, JMeter fires requests unrealistically fast.
TimerPurpose
Constant TimerFixed delay
Uniform Random TimerRandom delay
Gaussian Random TimerRealistic delay
Constant Throughput TimerMaintain TPS
Example
Constant Timer = 5000 ms → waits 5 sec before next request
06

Samplers

The Request📡
The actual requests sent to the server. This is where HTTP calls, API requests, DB queries, FTP, and JMS operations happen.
SamplerPurpose
HTTP RequestWeb / API calls
JDBC RequestDatabase queries
FTP RequestFTP operations
JMS PublisherMessaging
Example
POST /login → HTTP Sampler
07

Post-Processors

After Sampler🔍
Execute after the sampler response is received. Used for correlation, extracting dynamic values, parsing responses, and storing tokens/session IDs.
Post-ProcessorPurpose
Regex ExtractorExtract text patterns
JSON ExtractorExtract JSON fields
XPath ExtractorExtract XML data
JSR223 PostProcessorGroovy logic
Example — Extract Token
Response: {"token":"abc123"}
JSON Extractor → ${token} = abc123
08

Assertions

After Sampler
Validate whether the response is correct. Define PASS or FAIL conditions for each request.
AssertionPurpose
Response AssertionValidate response text
Duration AssertionValidate response time
JSON AssertionValidate JSON content
Size AssertionValidate payload size
Example
Check response contains "Login Successful"
If not found → Request marked FAILED
09

Listeners

Results Collection📊
Collect and display test results — response time, TPS, errors, graphs, and percentiles.
ListenerPurpose
View Results TreeDebugging
Summary ReportAggregated metrics
Aggregate ReportStatistical metrics
Backend ListenerGrafana / InfluxDB
⚠️
Listeners consume memory. For high load tests: avoid heavy GUI listeners. Run Non-GUI mode, save CSV results, generate HTML report later.
🍕

Real-World Analogy — Ordering Food Online

JMeter ComponentReal-Life Analogy
Test Plan📋Entire food order process
Config Element🏪Restaurant settings (menu, address)
Thread Group👥Customers placing orders
Pre-Processor💳Preparing payment details
Timer💭Customer thinking time (what to order)
Sampler🛒Placing the order
Post-Processor🔖Extracting order ID / confirmation
AssertionVerify order was successful
Listener📱Order tracking / delivery report