XMLFile Object
Description
An object representing an XML file.
Methods
Check | Executes an XML checkpoint. |
GetData | Retrieves the data from the XML file. |
GetTOProperty | Returns the value of an description properties from the test object description. |
SetTOProperty | Sets the value of an description properties in the test object description. |
Check Method
Description
Executes an XML checkpoint.
Note: You create checkpoints and define the property checks for the checkpoint using the Design > Checkpoint > XML Checkpoint (From Resource) option. For more details, see the UFT One User Guide.
Syntax
XMLFile(description).Check CheckPoint(Name)
Argument | Type | Description |
---|---|---|
CheckPoint (Name) | Variant | The checkpoint object, which contains the expected values to be compared and verified during the test run. |
Note: If you want to retrieve the return value of a checkpoint, you must add parentheses around the name of the checkpoint in the statement. For example:
a = Browser("MyBrowser").Page("MyPage").Check
(CheckPoint("MyProperty")
)
Return Value
Boolean
The following example shows a checkpoint on an XML file.
XMLFile("example.xml").Check CheckPoint("example.xml")
GetData Method
Description
Retrieves the data from the XML file.
Syntax
XMLFile(description).GetData
Return Value
The following example uses the GetData method to copy the information from the example.xml file into a new XMLData object.
set XMLObj = XMLFile("example.xml").GetData Xmlstr = XMLObj.ToString( MsgBox(Xmlstr)
GetTOProperty Method
Description
Returns the value of an description properties from the test object description.
Note: You can use the GetTOProperty method to retrieve the values of only those properties that are included in the test object description. Specifying a property that is not included in the test object's description results in a warning status for the step and the test. For more details on adding properties to a test object description, see the UFT One User Guide.
Syntax
XMLFile(description).GetTOProperty(Property)
Argument | Type | Description |
---|---|---|
Property | String | The description properties to retrieve from the object description. |
Return Value
Variant
The following example uses the GetTOProperty method to retrieve the value of the custom
property from the XMLFile object.
custom=XMLFile ("example.xml").GetTOProperty ("custom")
Tip: Use the Add/Remove option in the Object Repository window to add custom description properties to an XMLFile object.
GetTOProperty Method
Description
Sets the value of an description properties in the test object description.
Example: Notes:
SetTOProperty changes the property values used to identify an object during the test run. It has no effect on the values saved in the Object Repository for the object.
You can only set values of properties that are included in the test object description. For more details on adding properties to a test object description, see the UFT One User Guide.
Syntax
XMLFile(description).SetTOProperty Property, Value
Argument | Type | Description |
---|---|---|
Property | String | The description properties to set. |
Value | Variant | The value to assign to the listed property. |
XMLFile ("example.xml").SetTOProperty "custom", "my property"
Tip: Use the Add/Remove option in the Object Repository window to add custom description properties to an XMLFile object.