`
qt726qt
  • 浏览: 15853 次
最近访客 更多访客>>
社区版块
存档分类
最新评论

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
分享到:
评论

相关推荐

    自动调用qtp运行相关脚本

    自动调用qtp运行相关脚本 自动调用qtp运行相关脚本

    QTP 文件处理脚本

    QTP 文件处理脚本函数 可以直接在QTP中调用,不用再编写了

    脚本实例:用VBSCRIPT调用QTP应用程序并执行QTP脚本

    使用vbscript脚本调用QTP并运行脚本。 配合http://download.csdn.net/detail/nor1127/5394005的代码文件,将文件解压到D/Tests即可使用。

    QC连接QTP,远程调用QTP脚本

    QC连接QTP,配置QTP连接QC,利用QC远程执行QTP脚本,设置QTP定时运行脚本

    QTP脚本的封装和调用

    从经验中学习很多东西,帮助零基础学者少走弯路,

    TD连接QTP,TD调用QTP脚本

    检验TD是否安装成功,验证QTP安装成功,TD和QTP就连接起来,从TD调用QTP脚本

    自动化测试-远程启动QTP脚本

    在自动化测试框架中经常设计分布式执行用例,调用不同计算机机上的qtp来执行,如何远程调用qtp有以下几个方法: 1.利用qc启动相应机器上qtp执行自动化测试用例 打开QC 打开test lab--> in the execution flow-->...

    QTP脚本,实现脚本回放

    自动化录制脚本,主要用到函数调用,用计算器计算多数

    在QC中调用QTP进行测试

    介绍了如何在QC中调用QTP进行测试,可以在QC中执行一个单独的QTP脚本。

    qtp测试用例及测试脚本

    这是一个用qtp录制的脚本,每一个Action对应一个测试用例。 包括数据驱动,action调用,低级录制,场景恢复,功能键测试,检查点测试,正则表达式运用等。

    QTP下载链接.txt

    2)QTP支持的脚本语言是VB,这对于测试人员来说,感觉要“舒服”得多(如相比SilkTest采用C语言)。VB毕竟是一种松散的、非严格的、普及面很广的语言。 3)QTP支持录制和回放的功能。录制产生的脚本,可以拿来作为...

    QTP描述性编程技术集锦

    2. 描述性编程2 15 3. 函数 17 3.1. QTP中几个截取字符串的函数 18 4. "+" "&"的区别 20 5. QTP场景恢复 21 6. QTP中测试环境的初始化 27 7. QTP将数据库中的数据导入到excel 29 8. 在QTP中将数据库的数据导入到...

    初学QTP简单实例,设置检查点并通过参数设置调用多个测试数据反复执行脚本。

    一个关于QTP使用的简单实例,了解如何设置检查点,通过参数调用多个测试数据反复执行脚本。

    QC管理QTP脚本参数及运用

    QC管理QTP脚本参数及运用,QC中调用QTP脚本,并且设置参数,QC中制定测试计划,准备测试数据

    QTP技术集锦--总结

    40. 两种方法参数化link 101 41. WScript 102 42. QTP Plus 的应用 109 43. 一个万能的键盘模拟函数 110 44. XML参数化 115 45. Oracle QTP 115 46. 对象库的管理与合并 116 47. change sysdate 120 48. Import ...

    qtp学习与实践经验总结

    2 QTP的录制 29 2.1 QTP的录制方法 29 2.2 QTP录制应先作录制计划 29 2.3 关于下拉菜单的更改 30 2.4 输入法对于回放的影响 32 2.5 如何修改系统时间 32 3 QTP的自定义操作 33 3.1 手工添加步骤 33 3.2 手工识别控件...

    loadrunner调用QTP脚本来实现性能测试

    临近春节过年回家之际,现场又出问题,并发情况下游标报错。一封邮件让我周末不得不加班研究如何来模拟实际生产环境。大致需求是根据抄表段编号和...  对于这样的问题,开始我想挺好解决的,只要在脚本中加个循环控

    qtp1.5 launch

    qtp launch,调用vbs文件自动启动qtp运行测试脚本,远程call自动化测试

    轻量级自动化测试框架-QTP Based

    经过检查分析,主要是两方面原因导致,一是对象库的文件,默认生成得每个空的对象库文件为192K,这样一个空的QTP脚本文件就至少需要192K*2=384K的空间(Action0和Action1),如果分割的Action多的话,占用的空间就...

    qtp计算器脚本

    读Excel文件中的计算式,调用计算器实现自动计算 【Dim aslen,t , iRowCount, iLoop, numAdd,xlApp, xlFile, xlSheet Set xlApp = CreateObject ("Excel.Application") Set xlFile = xlApp.Workbooks.Open ("c:\a....

Global site tag (gtag.js) - Google Analytics