How to Determine What Data a Selector Extracts

Applies to LoadComplete 4.97, last modified on May 20, 2019

Usually, when you create data selectors that extract data from a response body, you need to determine what data the selector will extract. This will help you check whether you specified an appropriate regular expression. You may also want to check the extracted data during the test run to verify that the tested server returns the expected values.

See the sections below for detailed information on how to perform these tasks.

Checking Data Selectors at Design Time in the Create Data Selector Wizard

When you create a new data selector with the Create Data Selector wizard, you can check what data the selector extracts on the Specify the regular expression to use page of the wizard.

The wizard shows the created regular expression and the response contents with the matching data highlighted. If several text fragments match the regular expression, you can select each of them on the list, to view the corresponding fragment.

If needed, you can modify the created regular expression.

If no matching data is found, the wizard page displays a notification about it.

For information on how to create data selectors by using the wizard, see Create Data Selector Wizard.

Checking Data Selectors at Design Time in the Scenario Editor

With the Create Data Selector Wizard
  1. Open your scenario for editing and select the needed server response.

  2. In the Data Selectors panel of the response, find the data selector that you would like to check.

  3. Click the ellipsis button in the Expression column of the selector.

  4. LoadComplete will open the Create Data Selector wizard with the value matching the regular expression highlighted in the response contents.

    If the matching value is not found, the wizard will show a notification.

With the Find Dialog
  1. Open your scenario for editing and select the needed server response.

  2. In the Data Selectors panel of the response, find the data selector that you would like to check.

  3. Copy the selector’s regular expression to the clipboard. To do this, click within the Expression cell, in the ensuing in-place editor select the entire expression and then right-click the selection and choose Copy from the context menu.

  4. Click on the editor’s toolbar or press Ctrl+F. This will invoke the Find dialog.

  5. In the dialog:

    • Specify the selector’s regular expression in the Find what box. To do this, right-click the box and then click Paste.

    • Expand the Find Options section of the dialog and select Use: Regular expressions.

  6. Click Find Next to search for text matching the regular expression you specified.

    LoadComplete will find a response that contains the matching value and highlight that value in the response’s contents.

    Note: If there are several occurrences of the sought-for text in the response data, LoadComplete will extract the first occurrence. Therefore, you may need to click Find Next a few times to find the last occurrence.

Checking Extracted Data During the Test Run

To check what your data selectors extract from a server response to a variable during the test run, create a validation rule for that variable in the Scenario editor.

During the test run, LoadComplete will apply the data selector to extract data to the variable and then compare the variable value against some expected data. See About Validating Response Contents for detailed information.

See Also

About Data Selectors
Response Body Panel
Regular Expressions Syntax
Finding Text in the Scenario Editor
About Validating Response Contents
Creating Validation Rules
Create Data Selector Wizard

Highlight search results