Compartir a través de


TRAP Function (TestPage)

Traps the next test page that is invoked and assigns it to the test page variable.

TestPage.TRAP

Parameters

  • TestPage
    Type: TestPage The test page variable that you use to refer to the test page.

Remarks

You can trap only nonmodal pages with the TRAP function. To trap modal pages that you invoke with the RUNMODAL Function (Page) or the PAGE.RUNMODAL Function, you must use the ModalFormHandler function. For more information, see How to: Create Handler Functions.

Example

This example shows how to use the TRAP function to trap a call to open a test page so that the opened page is assigned to a variable.

This example requires that you create the following variables.

Variable name DataType Subtype

CustomerCard

TestPage

Customer

CustomerStatistics

TestPage

Customer Statistics

CustomerCard.OPENEDIT; 
CustomerStatistics.TRAP; // The next page that is invoked will be trapped and assigned to the CustomerStatistics variable.
CustomerCard."Page Customer Statistics".INVOKE; // Invokes an action from the Customer Card page. 
CustomerStatistics."Balance (LCY)".ASSERTEQUALS(0); // Now that the CustomerStatistics test page is open, you can use the variable to test the page.