使用vbs脚本启动QTP并运行测试,startQTP.vbs

'************************************************************************************************************************
'Description:
'
'This example opens a test, configures run options and settings,
'runs the test, and then checks the results of the test run.
'
'Assumptions:
'There is no unsaved test currently open in QuickTest.
'For more information, see the example for the Test.SaveAs method.
'When QuickTest opens, it loads the add-ins required for the test.
'For more information, see the example for the Test.GetAssociatedAddins method.
'************************************************************************************************************************ Dim qtApp 'As QuickTest.Application ' Declare the Application object variable
Dim qtTest 'As QuickTest.Test ' Declare a Test object variable
Dim qtResultsOpt 'As QuickTest.RunResultsOptions ' Declare a Run Results Options object variable Set qtApp = CreateObject("QuickTest.Application") ' Create the Application object
qtApp.Launch ' Start QuickTest
qtApp.Visible = False ' Make the QuickTest application visible ' Set QuickTest run options
qtApp.Options.Run.ImageCaptureForTestResults = "OnError" qtApp.Options.Run.RunMode = "Fast"
qtApp.Options.Run.ViewResults = False qtApp.Open "D:\NewTest\Scripts\BeforeGlobal\Login", False ' Open the test in read-only mode ' set run settings for the test
Set qtTest = qtApp.Test
qtTest.Settings.Run.IterationMode = "oneIteration" ' Runs the test only once, using only the first row in the global Data Table
'qtTest.Settings.Run.IterationMode = "rngIterations" ' Run only iterations 2 to 4
'qtTest.Settings.Run.StartIteration = 2
'qtTest.Settings.Run.EndIteration = 4
qtTest.Settings.Run.OnError = "NextStep" ' Instruct QuickTest to perform next step when error occurs
qtApp.Test.Settings.Web.BrowserNavigationTimeout = 60000 ' Configure other Web settings Set qtResultsOpt = CreateObject("QuickTest.RunResultsOptions") ' Create the Run Results Options object
qtResultsOpt.ResultsLocation = "D:\NewTest\Res1" ' Set the results location qtTest.Run qtResultsOpt ' Run the test 'MsgBox qtTest.LastRunResults.Status ' Check the results of the test run
qtTest.Close ' Close the test
qtApp.Quit 'Close the QTP
Set qtResultsOpt = Nothing ' Release the Run Results Options object
Set qtTest = Nothing ' Release the Test object
Set qtApp = Nothing ' Release the Application object

更多详细信息可以参考QTP帮助文件AutomationObjectModel.chm中Application Object (若chm内容为空,可参考CHM文件使用问题

【QTP专题-优化】VBS脚本启动QTP并运行测试的更多相关文章

  1. [vbs]脚本启动

    Set ws = CreateObject("Wscript.Shell") ws.run "cmd.exe /c start tool.exe config_tence ...

  2. QTP关于AOM的Javascript启动方式

    序 QTP的AOM模型想必大家都很熟悉了,平时常用的就是通过VBS脚本的方式编写启动程序(也是我现在用的方法).其实,还有很多其他的方式,如Java,C#,JS,这些语言都是通过调用QTObjectM ...

  3. 【QTP专题】05_参数化之Excel

    QTP使用外部Excel实现参数化主要有以下两种方式 导入到DataTable中 Syntax:DataTable.ImportSheet(FileName, SheetSource, SheetDe ...

  4. VBS脚本完美实现开机延时启动

    目录 概述 vbs内容示例: vbs示例语句分析 自定义vbs脚本 一些问题和解决方法   概述 系统开机时,顺带自动启动了不少驱动程序,使得电脑开机后鼠标要呆滞许久.为了加快windows的开机速度 ...

  5. Vbs脚本经典教材(转)

    Vbs脚本经典教材(最全的资料还是MSDN) —为什么要使用Vbs? 在Windows中,学习计算机操作也许很简单,但是很多计算机工作是重复性劳动,例如你每周也许需要对一些计算机文件进行复制.粘贴.改 ...

  6. VBS脚本病毒特点及如何防范3(转)

    5.Vbs病毒生产机的原理介绍 所谓病毒生产机就是指可以直接根据用户的选择产生病毒源代码的软件.在很多人看来这或许不可思议,其实对脚本病毒而言它的实现非常简单. 脚本语言是解释执行的.不需要编译,程序 ...

  7. VBS脚本随笔

    1.定时运行程序与关闭程序的VBS处理方法: do set ws=createobject("wscript.shell") ws.run"你要运行的程序的路径(比如说d ...

  8. vbs脚本实现自动打字祝福&搞笑

    脚本祝福礼物 概述 听说抖音上流行一种用代码做程序表白的东西,,,, 当然我也不是要表白,,,, 但是好像蛮有意思的,,,, 于是,又学了一下vbs脚本,做了几个很不错的祝福脚本,不懂代码的可以直接戳 ...

  9. vbs脚本实现qq定时发消息(初级)

    vbs脚本实现QQ消息定时发送 目标 批处理又称为批处理脚本,强大的强大功能可以高效得实现很多功能,例如批量更改文件格式,批量进行文件读写,今天我们的目标是用vbs脚本编写可以发送qq消息的脚本,并利 ...

随机推荐

  1. 利用Condition实现多线程交替执行

    一.需求 A.B.C 三个线程,循环10次,打印出自己的名称,ABC,ABC,ABC... A.B.C 三个线程,循环10次,打印出自己的名称,A一次,B三次,C五次,ABBBCCCCC,ABBBCC ...

  2. Javascript 键盘事件

    window.document.onkeydown = function (e) { var evt = window.event || e;//兼容性处理 var keycode = evt.key ...

  3. java使用POI写Excel文件

    参考地址:http://www.cnblogs.com/xwdreamer/archive/2011/07/20/2296975.html 1 jar包 网上下载 2 源代码 package zjr. ...

  4. excel解析的几种实现方法

  5. 团队作业4Alpha冲刺

    仓库地址:https://gitee.com/ILoveFunGame/game_strategy_network.git 第一天 2018/6/13 1.1 今日完成任务情况以及遇到的问题. 1.1 ...

  6. 刷题向》关于一道尺取法的神题目(BZOJ4653)(HARD-)(BZOJ 30题纪念)

    不得不说,这也许会是一道长期在我的博客里作为“HARD”难度存在的题 这道题能很好的考验选手的思考能力,但本蒟蒻最后还是听了省队爷讲了之后才会...(默默面壁) 题目里,说对于每一个点,是用当前选出的 ...

  7. PHP微信授权登录信息

    文件1:index.php //换成自己的接口信息 $appid = 'XXXXX'; header('location:https://open.weixin.qq.com/connect/oaut ...

  8. Ajax与Controller的参数交互

    理论 jQuery.ajax( options )中重要参数设置 jQuery.ajax( options ) : 通过 HTTP 请求加载远程数据.通过jquery.ajax与SpringMVC的C ...

  9. orcle clob字段查询

    select utl_raw.cast_to_varchar2(DBMS_LOB.SUBSTR(column,2000,1)) from t

  10. c++对象模型是什么,对象的内存布局和结构问题

    在c++发明的初期对于c++对象模型的争论从来没有停止过直到标准委员会通过了最终的c++对象模型这件事情才变得尘埃落定.C++对象模型可能是最不需要去解释的,但是又是不得不去说的因为c++的入门最先接 ...