Skip to content

Checking your reading list…

Retry verification

Stay curious. Build better.

Appearance

Choose how BestHub looks on this device.

Changes apply immediately.

Search articles

Open Discover with these filters

Suggested searches

Using JMeter Pre‑Processors and Post‑Processors for Dynamic URL Load Testing
Operations 10 min read

Using JMeter Pre‑Processors and Post‑Processors for Dynamic URL Load Testing

This article explains how to employ JMeter's pre‑processor (HTML Link Parser) and post‑processor (Result Status Action) to create dynamic URL requests, simulate concurrent users, handle error responses, and visualize results for performance testing of web services.

JMeter provides two types of processors—pre‑processors and post‑processors—that can modify or intercept the content of sampler requests and responses within their scope.

Pre‑Processor (also called a pre‑processor) runs before a request is sent. For example, the "HTML Link Parser" can crawl all links on a target host and validate them, enabling scenarios such as automatically clicking every link on a site to check its validity.

Pre‑Processor Demo

To simulate multiple virtual users each requesting a different URL on a host (e.g., various Baidu sub‑domains), the "HTML Link Parser" pre‑processor is used.

Test steps:

Create a scenario with many concurrent users.

Send HTTP requests to the target host (e.g., www.baidu.com) with URLs based on the host.

View the results.

JMeter Implementation Steps

1. Add Thread Group

Right‑click the Test Plan and add a new Thread Group (Add → Threads (Users) → Thread Group).

Configure the thread properties, e.g., 10 virtual users each sending 10 requests (total 100 requests).

2. Add WHILE Logic Controller

Use a WHILE controller to loop the scenario, allowing each virtual user to send random URLs repeatedly.

3. Add HTTP Request

Inside the WHILE controller, add an HTTP Request sampler (Add → Sampler → HTTP Request) and set the path to "/.*" so JMeter will request any URL under the domain www.baidu.com.

4. Add Pre‑Processor "HTML Link Parser"

Right‑click the HTTP Request and add a Pre‑Processor → HTML Link Parser to parse all links on the host.

5. Add View Results Tree

Add a Listener → View Results Tree to inspect each request and response.

6. Run Test

Click the Run button, then view the results tree to see the URLs requested and their responses.

Post‑Processor

A post‑processor runs after a sampler request. It can be used to stop a test when a server response indicates an error.

Post‑Processor Demo

Scenario: Send HTTP requests to www.google.com; if the response is an error, stop the test.

Test steps:

Send HTTP request to the target server (www.google.com).

Receive response from Google.

If the response is an error, stop the current test.

If the response is normal, continue with subsequent test tasks.

JMeter Implementation Steps

1. Add Thread Group (same as pre‑processor demo).

2. Add Configuration Element → HTTP Request Defaults and set the domain to http://www.google.com.

3. Add HTTP Request sampler (no specific path initially).

4. Add Post‑Processor → Result Status Action and select "Stop Test Immediately" so the test halts on error responses.

5. Add View Results Tree listener to observe responses.

6. Run the test; when an error response (e.g., path "xyz") is received, the test stops before completing all 100 requests.

Changing the path to a valid URL (e.g., "calendar") results in normal responses and the test runs to completion.

Conclusion

This guide demonstrates how JMeter pre‑processors and post‑processors can be applied in typical testing scenarios to dynamically generate requests, handle error conditions, and provide detailed result analysis, helping testers extend the capabilities of their performance test scripts.

About this article

For questions about attribution, corrections or content rights, please contactadmin@besthub.devand we will review it promptly.

Report an issue with this article
Performance TestingJMeterload testingPreprocessorpostprocessor

Reader feedback

Was this useful?

Useful0

Discussion 0

Questions, practical examples and thoughtful responses.

Open full discussion