Skip to Main Content
Return to Navigation

PTF Test Language

This section discusses:

Validation

Each step type allows only certain actions. Similarly, each action can only be used with certain step types.

The PTF Test Editor automatically limits your choice of actions based on the step type selected.

For example, if a step has the Type field set to Text and the Action field set to Set_Value, you can change the Action field to Verify since it is included in the list of available values for a text object.

This example shows a drop-down list with Verify as one of the values for the Action field when the Type field is set to Text:

Image: Action Drop-Down List for Text

This example illustrates the drop-down list showing available actions for the step type:Text.

Action drop-down list for Text

Parameters

Typically, you place parameters in the Recognition field and use the following structure:

param=value;

Separate parameters with a semi-colon.

For example:

prcname=RCOM01; wait=true;

With a Radio object, you can also place parameters in the Value field.

See Radio.

Steps that return a value require the parameter ret=&variable;

For example:

ret=&chart_val;

The system ignores unneeded parameters. For example, Browser.Start and Browser.Start_Login do not take any parameters, so the system ignores any values in the Recognition field for Browser.Start or Browser.Start_Login.

Prompting for Parameters

The PTF Test Editor provides context sensitive help for parameters. Double-click in the Recognition column to display and enter the parameters. For each parameter, an explanation and example are displayed.

For examples see Context Sensitive Help within Grid for Function Parameter Details

Variables

Variables enable you to work with steps in which the information or values are not known when you create the test or the information or values for a step change each time the test executes.

You prefix variables with an ampersand (&).

In this example, the first step stores the value in the OPRID field to the variable &OPRID. The second step populates the field OPRDEFNDESC with the value in the variable &OPRID.

Image: Example of Using Variables in Test Steps

This example illustrates how variables can be used in test steps.

Example of using variables in test steps

System variables are predefined variables that PTF populates at runtime. For instance, %test% is populated with the test name at runtime.

Reserved Words

Similar to variables, you use reserved words to supply information that is not known until a test executes.

Prefix reserved words with a pound sign (#) and use them in the Value field of a test to verify a condition, change the value in an application field, or both. In this example, the #TODAY reserved word sets the EFFDT_FROM field to the current date.

Image: Example of using the #TODAY reserved word

This example illustrates how the reserved word #TODAY can be used in a test step.

sm_#Today1_tptf

System Variables

System variables are predefined variables that PTF populates at runtime. System variables provide data about the current environment, execution options, test, and application.

Because system variables are replaced with a text string at runtime, you can place a system variable wherever you would place a text string. Commonly, test developers assign a system value to a user-defined variable.

The following example shows two methods of assigning system variables to user-defined variables:

Image: Example of using system variables

This example illustrates 2 methods for assigning system variables to user-defined variables.

Example of using system variables

Check Syntax

If the syntax or value in a test step is not correct, the test will produce an error when the test is executed. The Check Syntax option allows a user to validate the parameters provided in their steps either on save or on demand prior to execution.

Check Syntax will:

  • Display an error message for any invalid or missing required parameter values.

  • Display a error message for any invalid optional parameter values.

  • Display a warning message when the return value of a step has not been entered.

  • Display an error window listing all errors and warnings found in sequential order for a test.

    Note: There may be multiple errors in a single step.

  • Display an error when syntax is incorrect or missing, such as verifying that all Conditional.If steps are paired with Conditional.End_if steps.

Note: Syntax check only validates active steps. Only syntax is validated, not data.

Check Syntax does not validate:

  • PTF Functions

  • System variables

  • Reserved words

  • Condition sign

  • File and folder names

  • Duplicated parameters

  • Missing values

  • Parameter that is not available for the action

  • Missing parameter name

Running On Demand Syntax Check

After you have edited your test, select Test, Check Syntax or click the Check Syntax icon. The errors and warnings will be displayed. When you click on the error or warning in the Test Check Syntax window, the step is highlighted in the test.

Image: Test Syntax Check Showing 2 Errors

This example illustrates the check syntax dialog box with 2 errors.

Test Syntax Check showing 2 errors

If the syntax check does not detect any errors or warning, the dialog box will not return any rows of data:

Image: Test Syntax Check Showing No Errors or Warnings

This example illustrates the check syntax dialog box with no errors.

Test Syntax check showing no errors or warnings

Automatically Running Syntax Check on Save

To have Syntax Check run automatically every time you save a test:

  1. In PTF Explorer, click on your environment name and select Local Options.

  2. In the Auto-Check Syntax field select Yes and click OK.

  3. When you save a test, you will be prompted to run the syntax check.

Context Sensitive Help within Grid for Function Parameter Details

For any step type/action including parameters, you can double-click in the Recognition column to display and enter the parameters. For each parameter, an explanation and example are displayed. This is an example of the step Process.Run:

Image: Parameter Dialog Box for Step:Process.Run

This example illustrates the fields and controls on the Parameter dialog box for Step:Process.Run. You can find definitions for the fields and controls later on this page.

Parameter dialog box for Step:Process.Run

For step type Query, you can also double-click in the Value column to display and enter Query parameters.