Updated on 2024-01-18 GMT+08:00

Setting Response Extraction

Response extraction is to extract a part of the API response result and name it as a parameter for invoking in subsequent test steps. Response extraction needs to be defined in the previous test steps and used in subsequent test steps.

  • In the Pre-steps tab page, create the parameters to be passed on the Extract Response tab page. Built-in parameters are used for response extraction. For details, see Built-in Parameters. Response extraction also supports regular expression matching and extracts the return value that matches the given regular expression.
  • In subsequent test steps, use ${parameter name} to reference the response extraction created in the previous test steps. This parameter can be referenced in the URL, request header, and request body in subsequent steps. If this parameter is referenced in the request body in JSON format, enclose the parameter with quotation marks. For example:
    {
    id: "Test case ID"
    name:"${name}"
    }

  • The response extraction function can obtain strings based on the specified key:value. For details, see Example: Obtaining a String from the Response Body Based on the Specified key:value.

    Parameter

    Description

    Output Parameter

    ${Output Parameter}, which will be referenced later. The name consists of letters, digits, and underscores (_).

    Source

    Source of the detected field, such as the response body (JSON), response header, and response code.

    Property

    Advanced Extraction Type

    (Optional) Use the advanced extraction type to assist in extracting response information. If N/A is selected, no additional matching mode is used.

    Currently, there are two modes:

    For the advanced extraction type, the string extraction function is preferred. If the function cannot meet the requirements, you can use the regular expression.

    Assign Value to Dynamic Environment Parameter

    Assigns the value extracted from the response to the dynamic parameter so that the dynamic parameter can be referenced in subsequent tests.