How to use Formulas in Checkpoints

You can use a formula in a checkpoint to confirm that an object created on-the-fly or another variable object in your Web page or application contains the value it should for a given context. For example, suppose a shopping cart Web site displays a price total. You can create a text checkpoint on the displayed total value and use a Data Table formula to check whether the site properly computes the total, based on the individual prices of the products selected for purchase in each iteration.

When you use the Data Table formula option with a checkpoint, QTP creates two columns in the Data Table. The first column contains a default checkpoint formula. The second column contains the value to be checked in the form of an output parameter. The result of the formula is Boolean—TRUE or FALSE.

A FALSE result in the checkpoint column during a test run causes the test to fail. After you finish adding the checkpoint, you can modify the default formula in the first column to perform the check you need.

You may need to follow below steps to use a formula in a checkpoint in QTP:

  • Select the object or text for which you want to create a checkpoint and open the Insert Checkpoint dialog box.
  • In the Configure value area, click Parameter.
  • Click the Parameter Options button.
  • Select Data Table as the parameter type and choose a parameter from the Parameter name box list or enter a new name.
    • To use an existing parameter, select it from the list
    • To create a new parameter, either use the default parameter name or enter a descriptive name for the parameter
  • Select the Use Data Table formula check box and click OK to close the Parameter Options dialog box.
  • Specify your other checkpoint setting preferences. Click OK. The two columns are added to the table, and the checkpoint step is inserted into your test.
  • Highlight the value in the first (formula) column to view the formula and modify the formula to fit your needs.
  • If you want to run several iterations, add the appropriate formula in subsequent rows of the formula column for each iteration in the test or action.

In QTP, please note that that you cannot select Use Data Table formula if Regular expression is selected.

Rahnuma Tasnim

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top