Professional Documents
Culture Documents
com -
Checkpoints and validations can be done by capturing actual values from an object in the
Application and then comparing that value with some predefined value. QTP provides various
methods for capturing values from an Application object. We will discuss all of these methods
in detail.
Checkpoints
Checkpoints can be used for validating an Actual value against Expected value. A Checkpoints
can capture and compare multiple values. One problem with capturing values using
Checkpoints is that the capture values are not visible at run-time, they can only be viewed in
the test results summary. Thought it is possible to capture the final result of the Checkpoint
and see if it passed or failed. The code shown below demonstrated how to capture the result
of a checkpont
Dim bPassed
bPassed = Browser("X").Page("X").WebEdit("X").Check ( CheckPoint("Y") )
If bPassed Then
Msbox "Passed"
End if
Note that we have used parenthesis before and after ‘CheckPoint(”Y”)’, this is required when
we want to capture the value returned from Check method. If the return value is not to be
capture and only the Checkpoint needs to executed we can use
‘Browser(”X”).Page(”X”).WebEdit(”X”).Check CheckPoint(”Y”)’
Output Value
Output Value is used to extract property value from object and store it in DataTable or
Environment variable. Consider a Checkpoint “txtTest” which extracts the value of “html tag”
and “value” of a text box into the Global DataTable. Example of an Output Value is shown
below
Browser(”X”).Page(”X”).WebEdit(”txtTest”).Output CheckPoint(”txtTest”)
Running the above code will output value of the “html tag” and “value” property into the
DataTable.
GetROProperty
GetROProperty method can be used to fetch property values for an object. The “txtTest”
Checkpoint we used earlier can be simulated using GetROProperty as shown in the code below
DataTable("txtTest_html_tag_out", dtGlobalSheet) =
Browser("X").Page("X").WebEdit("txtTest").GetROProperty("html tag")
DataTable("txtTest_value_out", dtGlobalSheet) =
Browser("X").Page("X").WebEdit("txtTest").GetROProperty("value")
Using GetROProperty makes things more flexible when compared with Output Values. Output
Value can only fetch the values into DataTable or Environment, on the other we can use
GetROProperty to fetch data in any variable or data storage holder.
When it comes to choosing the best method for capturing values, i vote for GetROProperty for
the following reasons