In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
Today, I helped a Canadian friend to solve the problem of VB calling QTP. I wrote a Demo myself.
Here is the source code
1. New project, introducing QuickTest Professional 8.0 object library
two。 The code is as follows:
Private strScriptName As String
Private strRunScript As String
Private Sub cmdAddScript_Click ()
StrScriptName = InputBox ("Please enter the path and name of the QuickTestPro script", "Select Script")
LstQtpScript.AddItem strScriptName
StrScriptName = ""
End Sub
Private Sub cmdRunScript_Click ()
If strRunScript = "" Then
MsgBox "please select you want to a running script in listbox"
Else
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 RunResultsOptions object variable
Set qtApp = CreateObject ("QuickTest.Application") 'Create the Application object
QtApp.Launch 'Start QuickTest
QtApp.Visible = True 'Make the QuickTest application visible
'Set QuickTest run options
QtApp.Options.Run.CaptureForTestResults = "OnError"
QtApp.Options.Run.RunMode = "Fast"
QtApp.Options.Run.ViewResults = False
QtApp.Open strRunScript, True 'Open the test in read-only mode
'set run settings for the test
Set qtTest = qtApp.Test
QtTest.Settings.Run.IterationMode = "rngIterations" 'Run only iterations 2 to 4
QtTest.Settings.Run.StartIteration = 2
QtTest.Settings.Run.EndIteration = 4
QtTest.Settings.Run. ' Instruct QuickTest to perform next step when error occurs
Set qtResultsOpt = CreateObject ("QuickTest.RunResultsOptions") 'Create the RunResultsOptions object
QtResultsOpt.ResultsLocation = strRunScript + "\ 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 QuickTestPro
Set qtResultsOpt = Nothing 'Release the Run Results Options object
Set qtTest = Nothing 'Release the Test object
Set qtApp = Nothing 'Release the Application object
StrRunScript = ""
End If
End Sub
Private Sub Form_Load ()
StrScriptName = ""
StrRunScript = ""
End Sub
Private Sub lstQtpScript_Click ()
StrRunScript = lstQtpScript.Text
End Sub
Because it is not specific about the use of vb, so how to build a new project has been omitted, if you are interested, you can find relevant books to learn.
The above code passed in vb6.0 winxp sp2 debugging.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.