51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 2183|回复: 1
打印 上一主题 下一主题

[原创] 自己写的一段得取xml文件的一段小代码

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2008-12-5 13:48:56 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
Dim nodelocation  'locate the node of xxxx_TestCasexxxx
Dim testcase      'testcasename
Dim details       'details
Dim status        'status
nodelocation=1

Function getXMLData(spriptname,qtpreport)
Dim j
Err.Clear
Set dom=CreateObject("microsoft.xmldom")
Set p=New RegExp
dom.load qtpreport
p.Pattern=spriptname&"_TestCase[0-99999]"
Do While 1
  On Error Resume Next
   nodetext=dom.getElementsByTagName("Obj")(nodelocation).text  
   If Err.Number=424 Then
     Exit do
   End If   
   If p.Test(nodetext)=True Then
     j=nodelocation
    Exit do
  End If
  nodelocation=nodelocation+1
Loop  
    If Err.Number<>424 Then
      testcase=dom.getElementsByTagName("Obj")(j).text
      details=dom.getElementsByTagName("Obj")(j).nextSibling.text
      status=dom.getElementsByTagName("Obj")(j).nextSibling.nextSibling.nextSibling.getAttribute("status")
      nodelocation=j+1
      MsgBox testcase
      MsgBox details
      MsgBox status  
    End If      
End Function

  Call getXMLData("Application","E:\qtpscript\FWTestProject\report\SDK_AppLication\20081104142522\Report\Results.xml")
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

该用户从未签到

2#
发表于 2008-12-5 13:52:44 | 只看该作者
沙发,支持原创
回复 支持 反对

使用道具 举报

本版积分规则

关闭

站长推荐上一条 /1 下一条

小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

GMT+8, 2024-9-21 15:41 , Processed in 0.088767 second(s), 29 queries .

Powered by Discuz! X3.2

© 2001-2024 Comsenz Inc.

快速回复 返回顶部 返回列表