How to Simulate HTTP Requests and Extract Responses with JMeter

This guide walks you through creating a JMeter thread group, adding HTTP samplers, configuring listeners, using the JSON Extractor to capture response data, and handling multiple variables, enabling you to chain API calls and validate responses efficiently.

Programmer DD
Programmer DD
Programmer DD
How to Simulate HTTP Requests and Extract Responses with JMeter

Http Request Simulation

1. Create Thread Group

Right‑click Test Plan → Add → Threads (Users) → Thread Group → rename the test plan.

2. Add HTTP Request Sampler

Right‑click the thread group → Add → Sampler → HTTP Request → fill in request parameters.

3. Start the HTTP Request

a. Add View Results Tree listener to see request results.

Right‑click thread group → Add → Listener → View Results Tree.

b. Click the green start button on the toolbar to run the test plan.

Note: The response data is shown as Text by default; you can switch to JSON Path Tester format.

Response Parameter Extraction

Often you need to use the response of one API as the request parameter of another, e.g., retrieve the ID of the first upcoming movie and then request its details.

Get the first movie ID: https://api.douban.com/v2/movie/coming_soon?count=2 Use the ID to request details:

http://api.douban.com/v2/movie/subject/${id}

1. Add JSON Extractor Post‑Processor

Right‑click the "Get upcoming movies" HTTP request → Add → Post‑Processor → JSON Extractor → fill in variable names and other settings.

Enter variable names (e.g., id, year) and optionally default values.

2. Add HTTP Request Sampler to Retrieve Movie Details

3. Run the Test Plan

In the View Results Tree you can see that the request parameters are correctly populated and the response contains the expected data.

For multiple variables, separate variable names with a semicolon (;) and provide corresponding default values; otherwise the test may fail due to missing variables.

When using multiple variables, also fill in Default Values to avoid errors.

In this example, id and year are set with default values of 0.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Performance TestingJMeterHTTPAPI testingJSON ExtractorResponse Parameter
Programmer DD
Written by

Programmer DD

A tinkering programmer and author of "Spring Cloud Microservices in Action"

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.