Wednesday, 16 September 2015

TEST OBJECT FUNCTIONS IN QTP


Test Object Functions

GetROProperty:
GetROProperty method to retrieve the current value of a test object property from a run-time object in your application.

For example:
you can retrieve the target value of a link during the run session as follows:
link_href = Browser("Mercury Technologies").Page("Mercury Technologies").Link("Jobs").GetROProperty("href")
-------------------------------------------------------------------------------------------------
GetTOProperty:
Description:
Returns the value of the specified property from the test object description.

Syntax:
object.GetTOProperty (Property)

Argument
Description
object
A test object of type WinTreeView.
Property
Required. A String value.
The property whose value is retrieved from the object description.

Return Value:A Variant value.  
Remarks:
GetTOProperty differs from the GetROProperty method. GetTOProperty returns the value from the test object's description. GetROProperty returns the current property value of the object in the application during the test run.
-------------------------------------------------------------------------------------------------
Exist:
Description :
Checks that an object exists.
Syntax :
DbTable(description).Exist([Timeout])

Argument
Type
Description
Timeout
Number
Optional. The length of time to search for the object before returning a True or False value.
    • If a timeout value is specified, QuickTest waits until it finds the object or until the timeout is reached.
    • If the value 0 is specified, the method returns the True or False value immediately.
    • If no value is specified, the value specified in the Test Settings dialog box for the Object Synchronization Timeout is used for tests.
For more information on the Object Synchronization Timeout, refer to the QuickTest Professional User's Guide
 
Return Value : Boolean
Example:
The following example creates a database checkpoint and then checks that the database table object exists.
DbTable("DbTable").Check CheckPoint("DbTable")
IsExists = DbTable("DbTable").Exist (0)
-------------------------------------------------------------------------------------------------
CheckProperty:

Description:
Checks whether the specified object property achieves the specified value within the specified timeout.

Syntax:
object.CheckProperty (PropertyName, PropertyValue, [TimeOut])

Argument
Description
Object
A test object of type ActiveX.
PropertyName
Required. A String value.
The name of the property whose value is checked. The available properties are listed in the Identification Properties page under the Properties section for each test object.
PropertyValue
Required. A Variant value. The expected value against which the actual property value should be checked. You can either use a simple value or you can use a comparison object together with the value to perform more complex comparisons.
TimeOut
Optional. An ULong object. The time, in milliseconds, within which QuickTest should check whether the actual value of the property matches the specified expected value. If no value is specified, QuickTest uses the time set in the Object Synchronization Timeout option in the Run tab of the Test Settings dialog box.


Return Value
A Boolean value.  Returns TRUE if the property achieves the value, and FALSE if the timeout is reached before the property achieves the value.
A TRUE return value reports a Passed step to the test results; a FALSE return value reports a Failed step to the test results.

-------------------------------------------------------------------------------------------------
WaitProperty:

Description:
Waits until the specified object property achieves the specified value or exceeds the specified timeout before continuing to the next step.

Syntax:
object.WaitProperty (PropertyName, PropertyValue, [TimeOut])

Argument
Description
Object
A test object of type ActiveX.
PropertyName
Required. A String value. The name of the property whose value is checked.
PropertyValue
Required. A Variant value. The value to be achieved before continuing to the next step.
TimeOut
Optional. A Long value. The time, in milliseconds, after which QuickTest continues to the next step if the specified value is not achieved. If no value is specified, QuickTest uses the time set in the Object Synchronization Timeout option in the Run tab of the Test Settings dialog box.

Return Value
A Boolean value.  Returns TRUE if the property achieves the value, and FALSE if the timeout is reached before the property achieves the value. A FALSE return value does not indicate a failed step.
-------------------------------------------------------------------------------------------------
GetContent:

Description:
Returns all of the items in the combo box list.
;’[
Syntax:
object.GetContent

Argument
Description
object
A test object of type AcxComboBox.



Return Value
A String value.  The returned string contains all of the items in the list separated by VBScript line feed characters.

-------------------------------------------------------------------------------------------------
Select:

Description:
Selects the specified item in the list, replacing any previously selected values.

Syntax
object.Select Item

Argument
Description
object
A test object of type WebList.
Item
Required. A Variant value. The value to select. The value can either be one of the items in the list or an index. To specify the index of the item to select, use "#index". Index values begin with 0.

Return Value:None.  
-------------------------------------------------------------------------------------------------
GetItemsCount:

Description
Returns the number of items in the combo box list.

Syntax
object.GetItemsCount

Argument
Description
object
A test object of type AcxComboBox.

Return Value : A Long value.  
-------------------------------------------------------------------------------------------------
GetItem:

Description
Returns the value of the item specified by the index.

Syntax
object.GetItem (Item)

Argument
Description
object
A test object of type AcxComboBox.
Item
Required. A Variant value. Numeric index of the item. Index values begin with 0.
Return Value:A String value.  
-------------------------------------------------------------------------------------------------
RowCount:

Description:
Returns the number of rows in the table.

Syntax:
object.RowCount

Argument
Description
object
A test object of type WebTable.

Return Value: A Long value.  
-------------------------------------------------------------------------------------------------
ColumnCount:

Description:
Returns the number of columns in a (report-style) list-view control.

Syntax:
object.ColumnCount

Argument
Description
object
A test object of type VbListView.

Return Value:A Long value.  

Remarks: Only the visible columns are counted.
-------------------------------------------------------------------------------------------------
GetCellData:

Description
Retrieves the contents of the specified cell from the table.

Syntax
object.GetCellData (Row, Column)

Argument
Description
Object
A test object of type AcxTable.
Row
Required. A Variant value. The 0-based index of the row containing the cell whose data you want to retrieve. The index value is recorded in the format "#N" where N is the 0-based row index. When entering the argument value manually, you can use any of the following string or number formats: "#N", "N", or N.
Column
Required. A Variant value. The name or 0-based index of the column containing the cell whose data you want to retrieve. The column value is recorded in the format "#N" where N is the 0-based column index. When entering the argument value manually, you can use any of the following string or number formats: "ColumnName", "#N", "N", or N.

Return Value: A String value.  

No comments:

Post a Comment