Detect and record dynamic values from request URLs

Identifying the dynamic value in the request URL involves the following steps:

1. Add a listener for “View Results Tree” under the thread group.

2. Choose the ‘Stop Thread’ option under ‘Action to be taken following a sampler error’ in the Thread Group.

3. Make that the input values for Loop Count, Ramp-up period, and Number of Threads (users) are all 1.

4.’Run’ should be selected.

5. The script can stop working at a specific sampling where correlation is needed.

.View the script and select the sample that failed during playback.

7. Look up the request URL in the “Path” column if there is no value in the Parameters and Data tab of the sample text.

8. Copy the URL value if you can find it.

Take a look at the ‘View Result Tree’ listener as the first step. Place the copied value in the search field of the provided View Result Tree listener, and then click the “Search” button.

Step 2: JMeter marks the request that contains this value. Select the first highlighted request.

3. Select the “Response Data” tab.

Step 4 – Select the ‘Reaction Body’ tab in the ‘Reaction Data’ menu.

Step 5 – Paste the same value again into the search area of the Response Body.

Step 6: Select the ‘Search’ button. Check the location in the response body where this dynamic value appeared. The lookup value is underlined.

Step 7 – After JMeter determines the value in the response body, copy the string to create a special regular expression.

Step 8 – Create a regular expression statement that can capture the dynamic value. The regular expression declaration in this case is:

session_code=([0-9a-z-]+)&

Step 9: Confirm that the regular expression is correct.

1. Type the same regular expression in the Recorded View Results Tree Listener search response box to confirm that the regular expression is correct.

2. Check the “Regular Exp.” option. checkbox

3. Press the “Search” button.

9. When you have found all the dynamic values, repeat these procedures.

The next phase is implementation.

How to implement the correlation:

1. To do this, add a regular expression extractor under the same sample whose response contains the dynamic value and place the regular expression declaration (from step 8) in the ‘Regular Expression’ field. Next to the template, the matching number, and the default value, add the name of the newly formed variable.

2. The final step is to use the syntax ${<RegExVaribaleName>} to replace every instance of dynamic values in subsequent requests. Refer to the image below:

3. Rerun the script to confirm that the correlation is accurate. You can also add a debug sampler or refer to the view results tree listener.

Scroll to Top