Handling Application Messages

This section discusses how to handle application messages.

Use the Message Recognition feature to specify how PTF will respond to messages, such as warning messages or error messages, issued by the application being tested.

For example, suppose you have the following manual test instructions:

12. Clear the Calculate all Plans checkbox. If you get the following 
    warning, click OK:
      Warning - Remember all plans must be selected to ensure an accurate 415
      limit calculation (48,17)

When you record the test, the step that triggers the message and the step that clicks OK might look like this:

Image: Example of steps that trigger and dismiss a warning

This example illustrates a step that triggers the message and the step to dismiss a warning.

Example of steps that trigger and dismiss a warning

However, some test cases belonging to this test might not deselect the Calculate all Plans check box in the first step. In these cases, the first step would not trigger the warning message and PTF would fail to find the OK button in the second step.

You could use conditional logic to evaluate whether the test case deselects the check box. Alternatively, you could use the Error Handling feature to indicate that PTF should click OK whenever that specific message appears in the application.

To create a message definition, access the Message Recognition dialog box.

  1. With a test open, click the Message Recognition icon.

  2. Enter the text of the message, or a portion of the text, in the Message field.

    The following example uses the message catalog number rather than the full message text.

    You can define message definitions at either the test or test case level. Message definitions defined at the test case level take precedence over message definitions defined at the test level.

  3. Select which button the step should click.

  4. Specify what action PTF should take after the button is clicked.

  5. To delete a message, select the message line and press the Delete key.

This example shows the Message Recognition dialog box. In this example when the application message (1040,3) error occurs, PTF will click the Cancel button and abort the test execution.

Note: Test case message definitions take precedence over test message definitions.

Image: Message Recognition dialog box

This example illustrates the fields and controls on the Message Recognition dialog box. You can find definitions for the fields and controls later on this page.

Message Recognition dialog box

This table lists the names and definitions of the elements on the Message Recognition dialog box:

Field or Control

Definition

Message

Enter the message, or portion of the message, displayed by the error. For example, you might use the Message Catalog numbers.

Button

Enter the button that PTF should click when it encounters the message.

Valid values are:

  • OK

  • Abort

  • Retry

  • Ignore

  • Yes

  • No

  • Cancel

Action

Select the action that PTF will take.

Valid actions are:

  • Continue: Log an Info message and continue processing.

  • Abort: Log a Fail message and stop test execution.