qileilove

          blog已經轉移至github,大家請訪問 http://qaseven.github.io/

          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

          posted on 2014-09-04 09:42 順其自然EVO 閱讀(377) 評論(0)  編輯  收藏 所屬分類: qtp

          <2014年9月>
          31123456
          78910111213
          14151617181920
          21222324252627
          2829301234
          567891011

          導航

          統計

          常用鏈接

          留言簿(55)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 新郑市| 丹凤县| 稻城县| 巴林右旗| 汝南县| 会泽县| 会东县| 邢台市| 育儿| 东丰县| 屯留县| 杂多县| 凤凰县| 辽阳市| 祁连县| 扬州市| 大化| 利辛县| 荥经县| 天津市| 永安市| 汨罗市| 呼图壁县| 烟台市| 营山县| 景洪市| 北川| 收藏| 墨江| 高台县| 连山| 察隅县| 镇安县| 特克斯县| 琼中| 石阡县| 东平县| 新巴尔虎右旗| 西峡县| 肥西县| 舟曲县|