09-21-2011, 03:24 PM
Hi There,
I am creating one tool to convert tsr file to XML file. I know in object repository manger export to xml option is available but I need customized XML which is different then QTP XML
I am able to get all the object and their property using existing object ObjectRepositoryUtil methods but not correct regular expression value from tsr.
If in TSR property value set true for regular expression and then using the following method it should retrieve the value correct value:
msgbox Property.RegularExpression
Output should be true for RE enable property value and false for not enable property values. But here I am finding discrepancy in this method. Value is displayed but not the correct one. Even if I enable true it shows false as an output
Please find the function which may be usefully for understanding
Please let me know for any further information.
Other suggestions are welcome. Would like to know if there is any other way.
I am creating one tool to convert tsr file to XML file. I know in object repository manger export to xml option is available but I need customized XML which is different then QTP XML
I am able to get all the object and their property using existing object ObjectRepositoryUtil methods but not correct regular expression value from tsr.
If in TSR property value set true for regular expression and then using the following method it should retrieve the value correct value:
msgbox Property.RegularExpression
Output should be true for RE enable property value and false for not enable property values. But here I am finding discrepancy in this method. Value is displayed but not the correct one. Even if I enable true it shows false as an output
Please find the function which may be usefully for understanding
Code:
Function EnumerateAllChildProperties(Root)
'The following function enumerates all the test objects under a specified object.
'For each test object, a message box opens containing the test object's name,
'properties, and property values.
Dim TOCollection, TestObject, PropertiesCollection, Property, Msg
Dim tmpCollection
Dim strObjNode
Dim strPropNode
Dim strObjType
Dim vPValue,vOName
Set TOCollection = RepositoryFrom.GetChildren(Root)
For i = 0 To TOCollection.Count - 1
Set TestObject = TOCollection.Item(i)
vOName = RepositoryFrom.GetLogicalName(TestObject)
vOName = Check_Replace_XMLSpChars(vOName)
strobjType = TestObject.GetTOProperty("micclass")
strObjNode = "<Object Type = '" & strObjType & "' Name = '" & vOName & "'>"
Set PropertiesCollection = TestObject.GetTOProperties()
strPropNode=""
For n = 0 To PropertiesCollection.Count - 1
Set Property = PropertiesCollection.Item(n)
vPValue = Property.Value
vPValue = Check_Replace_XMLSpChars(vPValue)
[b][size=x-large]Msgbox Property.RegularExpression [/size] strPropNode = [/b]strPropNode & "<Property Name = '" & Property.Name & "' Value = '" & vPValue & "' />" & vbNewLine
Next
ts.WriteLine strObjNode
ts.WriteLine strPropNode
EnumerateAllChildProperties TestObject
set tmpCollection = RepositoryFrom.GetChildren(TestObject)
If tmpCollection.Count >0 Then ts.WriteLine "</Object>"
Next
If TOCollection.Count < 1 then ts.WriteLine "</Object>"
End Function
Please let me know for any further information.
Other suggestions are welcome. Would like to know if there is any other way.