Detect and record dynamic values from the request body.

Identifying the dynamic value in the request body 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 may stop working on a specific sample where correlation is needed.

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

7. You will receive several parameter passing requests along with their values.

8. The value of the parameter must be copied into the ‘Value’ column.

Step 1: View the captured ‘View Result Tree’ listener.

Step 2 – Insert the copied value into the listener search field of the recorded view result tree, and then click the “Search” button.

Step 3 – JMeter marks the request that contains this value. Select the first request that is highlighted.

4. Select the “Response Data” tab.

Step 5 – Select the ‘Response Body’ tab from the ‘Response Data’ menu.

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

Step 7: Press the ‘Search’ button. Check the location in the response body where this dynamic value appeared. The search value is underlined.

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

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

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

Step 10: Confirm that the regular expression is correct.

  1. Write the same regular expression in the search box of the sampler’s response (Recorded View Results Tree Listener) to confirm the accuracy of the regular expression statement.
  2. Mark the “Regular exp.” checkbox.
  3. Hit the “Find” button.

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

How to implement the correlation:

1.To do this, add a regular expression extractor under the same sample whose response contains the dynamic

2. value and place the regular expression declaration (from step 9) in the ‘Regular Expression’ field.

3. In addition to the template, agreement number, and default value, provide 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