Tuesday, August 21, 2007

QTP Tutorials 11 - Checkpoint Return Value

We will use the Standard Checkpoint which we did in tutorial 4.

Open that test that contains the standard Checkpoint.
In the expert view of the test you will see only one line i.e.

Window("Flight Reservation").WinButton("FLIGHT").Check CheckPoint("FLIGHT")

Now we will make some changes in this one line so that it can return some value.

NOTE: Checkpoint always returns a value, it depends on us whether we capture it or not.

Lets now capture it.
Declare a variable and catch the return value in that variable:

Dim return
return = Window("Flight Reservation").WinButton("FLIGHT").Check CheckPoint("FLIGHT")
msgbox (return)

One thing more we need to do here is that we have to enclose Checkpoint ("FLIGHT") in brackets. So the final version looks like this:

Dim return
return = Window("Flight Reservation").WinButton("FLIGHT").Check (CheckPoint("FLIGHT"))

msgbox (return)

Now run the test and see the msgbox appearing with the return value.

Also See:

Checkpoints in QTP
Example of QTP Standard Checkpoint
Example of QTP Existing Checkpoint
Example of QTP Page Checkpoint
Example of QTP Database Checkpoint
Example of QTP Bitmap Checkpoint
Example of QTP Image Checkpoint
Example of QTP Text Checkpoint
Example of QTP Table Checkpoint
Difference between Text & Text Area Checkpoint