Requests correlation#

Boomq lets you extract values from the response, for example, to get a session token. If the response contains values corresponding to the specified expression or boundaries, then the values are written to the variable. You can use the value of the variable as a parameter in the following test requests.

To extract values from the response, follow these steps:

  1. Open the test project.

  2. Go to the group or click edit_button.

  3. Click edit_button for the required request and go to the Extract from response tab:

    _images/um_extract_from_response.en.png
  4. Select the value from the drop-down list:

    • Regex. Regular expression.
      1. Fill in the fields:

        • Variable name. The variable into which the parsing results are saved.

        • Regular expression.

        • Group’s number. The group to be extracted from the regular expression. For example, 1 value extracts the first group value. The default is 0 value, used to extract the whole regexp.

      2. Select the field from which you need to extract the values:

        • Body. The response body without headers.

        • Request headers.

        • Response code. For example, 200.

        • Response message.

        • Url. Request URL.

      3. Select the value from the drop-down list:

        • Random match. To select any of the values.

        • Specific match. To select a particular value.

        • All matches. To select all values. As a result, an array of values is formed: Param_1, Param_2, Param_n, where Param is the name of the variable, and n is the size of the array.

          Note

          When using the extracted parameter, manually specify the sequence number of the occurrence: ${param_n}, where n is the sequence number of the occurrence. If you use such a parameter or header without specifying the occurrence number, an empty value is sent.

    • jSONPath. JSONPath is a query language for JSON, similar to XPath for XML. For more information, see JSON path syntax in detail.
      1. Fill in the fields:

        • Variable name. The variable into which the parsing results are saved.

        • JSONPath expression.

      2. Select the value from the drop-down list:

        • Random match. To select any of the values.

        • Specific match. To select a particular value.

        • All matches. To select all values. As a result, an array of values is formed: Param_1, Param_2, Param_n, where Param is the name of the variable, and n is the size of the array.

          Note

          When using the extracted parameter, manually specify the sequence number of the occurrence: ${param_n}, where n is the sequence number of the occurrence. If you use such a parameter or header without specifying the occurrence number, an empty value is sent.

    • XPath. XPath uses path expressions to select nodes or node-sets in an XML document. For more information, see XPath Syntax.
      1. Fill in the fields:

        • Variable name. The variable into which the parsing results are saved.

        • XPath expression.

      2. Select the value from the drop-down list:

        • Random match. To select any of the values.

        • Specific match. To select a particular value.

        • All matches. To select all values. As a result, an array of values is formed: Param_1, Param_2, Param_n, where Param is the name of the variable, and n is the size of the array.

          Note

          When using the extracted parameter, manually specify the sequence number of the occurrence: ${param_n}, where n is the sequence number of the occurrence. If you use such a parameter or header without specifying the occurrence number, an empty value is sent.

    • Boundary. JMeter Boundary Extractor allows you to extract values from a server response using left and right boundaries. For more information, see JMeter Documentation.
      1. Fill in the fields:

        • Variable name. The variable into which the parsing results are saved.

        • Left border. Left boundary of value to find. This is an optional field.

        • Right border. Right boundary of value to find. This is an optional field.

          Example of using boundaries

          Task: get the name of the first user from the response:

          {
             "data": [
                {
                   "id": 1,
                   "email": "michael.lawson@company.name",
                   "first_name": "Michael",
                   "last_name": "Lawson",
                },
                {
                   "id": 2,
                   "email": "lindsay.ferguson@company.name",
                   "first_name": "Lindsay",
                   "last_name": "Ferguson",
                }
             ],
          }
          

          Solution:

          1. Enter a variable in the Variable name field, for example, user_id.

          2. Enter "first_name": " in the Left border field.

          3. Enter ", in the Right border field.

          4. Select the Response message field.

          5. Select the Specific match value and enter 1.

      2. Select the field from which you need to extract the values:

        • Body. The response body without headers.

        • Request headers.

        • Response code. For example, 200.

        • Response message.

        • Url. Request URL.

      3. Select the value from the drop-down list:

        • Random match. To select any of the values.

        • Specific match. To select a particular value. The occurrence numbers start with 1.

        • All matches. To select all values. As a result, an array of values is formed: Param_1, Param_2, Param_n, where Param is the name of the variable, and n is the size of the array.

          Note

          When using the extracted parameter, manually specify the sequence number of the occurrence: ${param_n}, where n is the sequence number of the occurrence. If you use such a parameter or header without specifying the occurrence number, an empty value is sent.

  5. Click Save.

To delete values extraction, click delete_button.

See also

Preview of the response#

For the convenience of configuring data extraction, use the preview of the response:

  1. Select a data source, for example, HAR.

  2. Go to the required tabs: Headers, Body, Cookies:

    _images/um_preview_response.en.png