51Testing软件测试论坛

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

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 1333|回复: 2
打印 上一主题 下一主题

[求助] qtp与外部xml文件数据的传递

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2013-7-5 10:58:49 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
我新建了一个xml文件,如何用vbs语言实现将case1运行过程中的值传送到case2的调用action中使用?
  例如 case1 运行中产生一个系统当前时间值currenttime,如何将这个值写入xml文件,并从case2中读取,应用在case2的action中。
  请各位高手帮帮忙
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

该用户从未签到

3#
 楼主| 发表于 2013-7-8 10:12:30 | 只看该作者
回复 2# wuxue107


    谢谢你,问题解决了
回复 支持 反对

使用道具 举报

该用户从未签到

2#
发表于 2013-7-5 22:30:20 | 只看该作者
下面就是我用的。

  1. Dim objconfig ,v_file
  2. Public Function openconfig(file)
  3.         v_file = file
  4.         Set objconfig = CreateObject("msxml2.domdocument")
  5.         If CreateObject("scripting.filesystemobject").FileExists(v_file) Then
  6.                 objconfig.load file
  7.         Else
  8.                 objconfig.loadXML "<root><param></param></root>"
  9.         End If
  10. End Function

  11. Public Function getconfig(name)
  12.         Set tmp = objconfig.selectSingleNode("/root/param/"&name)
  13.         If tmp Is Nothing Then
  14.                 getconfig = ""
  15.         Else
  16.                 getconfig = tmp.text
  17.         End If
  18. End Function

  19. Public Function setconfig(name,value)
  20.         Set tmp = objconfig.selectSingleNode("/root/param/"&name)
  21.         If tmp Is Nothing Then
  22.                 Set newelement = objconfig.createElement(name)
  23.                 newelement.text = value
  24.                 objconfig.selectSingleNode("/root/param").appendChild newelement
  25.         Else
  26.                 tmp.text = value
  27.         End If
  28.         objconfig.save v_file
  29. End Function

  30. ''########   使用例子  ##########
  31. openconfig "mm.xml"
  32. setconfig "testname","test01"
  33. MsgBox getconfig("testname")
复制代码
回复 支持 反对

使用道具 举报

本版积分规则

关闭

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

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

GMT+8, 2024-9-23 23:30 , Processed in 0.075449 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2024 Comsenz Inc.

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