zoukankan      html  css  js  c++  java
  • 【QTP专题-优化】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:NewTestScriptsBeforeGlobalLogin", 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:NewTestRes1" ' 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文件使用问题

  • 相关阅读:
    mysql——前面内容——前期整理笔记00
    mysql——触发器——概念
    mysql——触发器——示例
    mysql——多表——外连接查询——左连接、右连接、复合条件查询
    mysql——多表——合并查询结果
    IT职场人生系列之七:学外语
    IT职场人生系列之十三:技术?管理?业务?
    IT职场人生系列之五:怎样面试
    IT职场人生系列之十二:语言与技术I
    IT职场人生系列之四:怎样写简历
  • 原文地址:https://www.cnblogs.com/sylvia-liu/p/3713190.html
Copyright © 2011-2022 走看看