Mapping PSQuery to a Test

You can run an existing test using real-time data. The test will use query results to populate test data. The query results can have real-time data or modified data. You do not have to create a test case each time data changes. Use the DataLoader step type to include the modified query results in your tests.

Important! By default, one DataLoader step type is associated with one query. If you require more than one query for the test, insert respective DataLoader types.

Configure the fields on DataLoader tab on the Execution Options dialog box in PTF client. See DataLoader Tab.

Verify the user included in the Options tab of the Execution Options dialog box has access to the PTPT2200 permission list.

You can assign the QAS Admin role to the user which includes PTPT2200 permission list.

The DataLoader maps a query and the query fields to variables in the test. See DataLoader.

Click the edit button in the Recognition field of the step to open the Edit DataLoader dialog box.

Image: Edit DataLoader dialog box

The example illustrates the fields and controls on the Edit DataLoder dialog box with Query Parameters and Select Query Fields sections. You can find definitions for the fields and controls later on this page.

Edit DataLoader dialog box showing Query Parameters and Select Query sections

Field or Control

Definition

DataLoader Name

Enter an unique name that associates the test with the query.

DataLoader Type

Currently it displays Query and is disabled for change.

Query Name

Select the required query from the drop-down list.

Note: Queries displayed are according to the Query Security settings associated with your User ID in current Execution Options.

Query Parameters

Enter the parameter values. The section appears if the selected query has associated parameters.

Load Fields

Click the button to select the query fields from the list of available fields.

Select Query Fields

Displays the fields used in the query. Select and shift required query fields under Available Fields to Used Fields.

When you click the OK button on the Edit DataLoader dialog box, the variable mapping grid appears where you can edit variable names.

Image: Variable Mapping Grid for the DataLoader Instance

The example illustrates the fields and controls on the variable mapping grid for the DataLoader instance.

Variable Mapping Grid dialog box for the DataLoader instance

You can edit the variable name on the grid for the source fields.

Click the Edit Query button to open the Edit DataLoader dialog box to edit the query.

Note: The first row in the variable mapping grid is reserved for the rowcount variable which populates the total rows in the query result. The rowcount is used for a loop definition. Variable name of the (rowcount) field is blank by default. If you want to use the rowcount variable then you must provide a variable name.

You can bind the Loop step type to the DataLoader. To bind the Loop and DataLoader, add the variables which are defined in the DataLoader into related steps inside the Loop. PTF binds them automatically.

The total query result rows is assigned to the rowcount parameter which is used for the Loop step type.

Consider the following when you use the Loop step type with the DataLoader step type:

  • If rowcount related variable is used to control Loop, all the steps which are in the Loop step type and use the variables defined in the DataLoader is executed multiple times till the loop count is equal to the number of returned rows of the query.

  • If there are duplicate rows in a query result, PTF considers them as different rows and runs twice.

Example

This example illustrates using the Loop step type with the DataLoader step type.

Type

Action

Recognition

Parameters

Value

DataLoader

Load

name=S6

source=HMAP_EMPL_PHOTO;ownType=public;sourceType=NMQ;rowcount=&rowcount;

Loop

For

&Idx = 1 to &rowcount

  • DataLoader is not supported in a Shell Test.

  • One DataLoader step type is associated with only one PSQuery, and only standard queries are supported

  • Data with hierarchy can not be recognized in current DataLoader.

  • DataLoader doesn’t support changing login user during runtime.

  • DataLoader and Loop must be defined in the same test.

  • Bind a Loop step type with a DataLoader step type. The Loop uses variables defined in the DataLoader. Variables from different DataLoader step types cannot be used within the same loop. Assign the value of a variable from a different DataLoader step type to a new variable associated with the Loop.

  • If a date field is used as a prompt, the FieldValue must be entered as YYYY-MM-DD in the QASexecution request.

  • The query parameter name in DataLoader Editor is limited to 20 characters, if the length of parameter name is larger than 20, it will be truncated and suspension points will be added at the end.