xmlFilePath = "c:\Results.xml"
Set xmlDoc = CreateObject("MSXML.DomDocument")
If xmlDoc.Load (xmlFilePath) Then
'Get the test name
Set objNode = xmlDoc.GetElementsByTagName("DName")
.TestName = objNode(0).Text
Set objNode = xmlDoc.GetElementsByTagName("Summary")
'Last Node with tagName "Summary" has details of Pass/Fail status
Set Node = objNode(objNode.Length - 1)
intStepsPassed = Node.getAttribute("passed")
intStepsWarning = Node.getAttribute("warning")
''in case of failures get the testfailureReason
If Cint(intStepsFailed) > 0 Then
strFailureReason = getFailureReason(xmlFilePath)
End if
Set FSO = Nothing
Set xmlDoc = Nothing
End If
Public function getFailureReason(strFileName)
Set xmlDoc = CreateObject("Microsoft.XMLDOM")
xmlDoc.async = False
strErrorMsg = ""
booleanxmlParse = xmlDoc.load(strFileName)
if(booleanxmlParse) then
xmlDoc.setProperty "SelectionLanguage", "XPath"
set xmlDoc_node = xmlDoc.selectNodes("//Step//NodeArgs[@status='failed']")
for each node in xmlDoc_node
strNode = node.parentNode.getattribute("rID")
set TCNode = xmlDoc.selectSingleNode("//Step[@rID='" + strNode + "']/Details")
strErrorMsg=strErrorMsg & TCNode.text
Next
End If
getFailureReason = strErrorMsg
End Function
No comments:
Post a Comment