Sunday, June 15, 2008

QTP Tutorials 10 - 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)


It can return either true or false i.e. a boolean value. If it passes, it will return true else it will return false

0 comments: