VBS脚本启动QTP并运行测试

简介:
使用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

最新内容请见作者的GitHub页:http://qaseven.github.io/
相关文章
|
3月前
|
测试技术 Python
Playwright系列(4):录制测试脚本
Playwright系列(4):录制测试脚本
|
3月前
|
测试技术
软件测试/测试开发/全日制|Pytest如何灵活地运行用例
软件测试/测试开发/全日制|Pytest如何灵活地运行用例
33 0
|
4月前
|
Ubuntu Linux 定位技术
Trinitycore学习之在Linux环境上搭建服务器并测试运行
Trinitycore学习之在Linux环境上搭建服务器并测试运行
68 0
|
4月前
|
存储 C语言 Windows
音视频使用qt测试ffmpeg接口时无法运行
音视频使用qt测试ffmpeg接口时无法运行
45 0
|
4月前
|
应用服务中间件 测试技术 nginx
dpdk环境搭建及运行helloworld测试
dpdk环境搭建及运行helloworld测试
84 0
|
4月前
|
测试技术 Shell
shell脚本写的班级管理系统测试用例
shell脚本写的班级管理系统测试用例
58 1
|
4月前
|
JSON 测试技术 API
『Postman入门万字长文』| 从工具简介、环境部署、脚本应用、Collections使用到接口自动化测试详细过程
『Postman入门万字长文』| 从工具简介、环境部署、脚本应用、Collections使用到接口自动化测试详细过程
78 3
|
3月前
|
监控 数据可视化 Java
jvm性能调优实战 - 31从测试到上线_如何分析JVM运行状况及合理优化
jvm性能调优实战 - 31从测试到上线_如何分析JVM运行状况及合理优化
53 1
|
7天前
|
SQL 存储 分布式计算
Hive【基础知识 02-2】【Hive CLI 命令行工具使用】【详细举例-包含测试脚本文件】
【4月更文挑战第7天】Hive【基础知识 02-2】【Hive CLI 命令行工具使用】【详细举例-包含测试脚本文件】
15 0
|
15天前
|
JSON 测试技术 持续交付
自动化测试与脚本编写:Python实践指南
【4月更文挑战第9天】本文探讨了Python在自动化测试中的应用,强调其作为热门选择的原因。Python拥有丰富的测试框架(如unittest、pytest、nose)以支持自动化测试,简化测试用例的编写与维护。示例展示了使用unittest进行单元测试的基本步骤。此外,Python还适用于集成测试、系统测试等,提供模拟外部系统行为的工具。在脚本编写实践中,Python的灵活语法和强大库(如os、shutil、sqlite3、json)助力执行复杂测试任务。同时,Python支持并发、分布式执行及与Jenkins、Travis CI等持续集成工具的集成,提升测试效率和质量。