API Response Data
Many test scenarios depend on values that only exist at runtime: a newly created user ID, a session token, a dynamically generated order number. Rather than hard-coding these values or maintaining fragile fixtures, you can extract data directly from API responses and UI elements, then feed it into subsequent steps.
Using API Response Values
When a test includes an API step, the response data is available for extraction and reuse in later steps.
Process:
- Add an API step to your scenario (see Adding an API Step).
- Run the API step to populate the response.
- Open the Response Data section of the API step.
- Locate the value you want to reuse and click Add to Test Data.
- Save the scenario.
Once saved, the extracted value is:
- Available in the Test Data section of the Recorder for use in subsequent steps.
- Automatically added to the
Examplessection in the Gherkin file.
Using the extracted value:
- Open the Test Data panel in the Recorder.
- Copy the parameter name for the API response value.
- Paste it into any input field, assertion, or API payload where you need that value.
The value is resolved fresh on each execution, so your tests always use the actual response from that run.
Extracting Values from UI Elements
Sometimes the data you need is not in an API response but rendered on the page: a confirmation number, a calculated total, a generated reference code. BlinqIO lets you capture these values during recording.
Process:
- During recording, click the element that contains the value you want to capture.
- Choose which property to extract:
| Property | When to use it |
|---|---|
| Text content | The visible text of the element |
| HTML attribute | An attribute like href, value, or src |
| Data attribute | A custom data-* attribute (e.g., data-order-id) |
- Enter a variable name for the extracted value (e.g.,
order_number). - Optionally, apply a regex pattern to extract a specific part of the value. This is useful when the element text contains extra characters or labels you want to filter out.
Using the extracted value:
Once captured, the variable is available for the rest of the recording session. You can use it in:
- Input fields: Paste the variable to fill a search box with a previously captured order number.
- Assertions: Verify that a confirmation page displays the same value that was shown on a previous page.
- API payloads: Pass a UI-extracted value into a subsequent API request.
TIP
Combine API data and element extraction in the same scenario. For example, create a resource via API, extract its ID from the response, then verify the ID appears correctly in the UI.
