QTP的2种脚本调用方法是什么

QTP的2种脚本调用方法是什么
2011年06月14日
  我不知道你调用脚本是什么概念?在QTP中调用外部脚本?还是启动QTP脚本?
  调用外部脚本,你可以采取VBS的程序去调用外部程序,或者你可以写COM接口,然后再QTP的中调用!
  启动QTP脚本,你可以采取QTP的COM接口通过程序来调用
  (3atesing有大量视频专门介绍QTP的各类实用模式的)
  QTP的COM调用可参考:
  Set qtApp = CreateObject("QuickTest.Application") ' Create the Application object
  qtApp.Launch ' Launch QuickTest
  qtApp.Visible = True ' Set QuickTest to be visible
  ' Open a test and get the "Login" action's object repositories collection
  qtApp.Open "C:\Tests\Test1", False, False ' Open a test
  Set qtRepositories = qtApp.Test.Actions("Login").ObjectRepositories ' Get the object repositories collection object of the "Login" action
  ' Add MainApp.tsr if it's not already in the collection
  If qtRepositories.Find("C:\MainApp.tsr") = -1 Then ' If the repository cannot be found in the collection
  qtRepositories.Add "C:\MainApp.tsr", 1 ' Add the repository to the collection
  End If
  ' If InnerWnd.tsr is moved down the list - place it back at position 1
  If qtRepositories.Count > 1 And qtRepositories.Item(2) = "C:\InnerWnd.tsr" Then ' If there's more than one object repository and InnerWnd.tsr is in position 2
  qtRepositories.MoveToPos 1, 2 ' Switch between the first two object repositories
  End If
  ' If Debug.tsr is in the collection - remove it
  lngPosition = qtRepositories.Find("C:\Debug.tsr") ' Try finding the Debug.tsr object repository
  If lngPosition -1 Then ' If the object repository was found in the collection
  qtRepositories.Remove lngPosition ' Remove it
  End If
  ' Set the new object repository configuration as the default for all new actions
  qtRepositories.SetAsDefault ' Set object repositories associated with the "Login" action as the default for all new actions
  'Save the test and close QuickTest qtApp.Test.Save ' Save the test qtApp.Quit ' Quit QuickTest Set qtRepositories = Nothing ' Release the action's shared repositories collection Set qtApp = Nothing ' Release the Application object
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值