Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
VBS to launch QTP 9.2 and invoke script automatically
#1
Solved: 11 Years, 3 Months, 3 Weeks ago
Hi,
I need a VBS Script to launch QTP 9.2 and invoke the driver script automatically.....
Can you please help me with this?
Reply
#2
Solved: 11 Years, 3 Months, 3 Weeks ago
************************************************************************************************************************

'Description:

'

'This example configures QuickTest views and panes for running QuickTest in visible mode.

'************************************************************************************************************************



Code:
Dim qtApp 'As QuickTest.Application ' Declare the Application object variable

Set qtApp = CreateObject("QuickTest.Application") ' Create the Application object

qtApp.Launch ' Start QuickTest





qtApp.ActivateView "ExpertView" ' Display the Expert View

qtApp.ShowPaneScreen "ActiveScreen", True ' Display the Active Screen pane

qtApp.ShowPaneScreen "DataTable", False ' Hide the Data Table pane

qtApp.ShowPaneScreen "DebugViewer", True ' Display the Debug Viewer pane

qtApp.WindowState = "Maximized" ' Maximize the QuickTest window

qtApp.Visible = True ' Make the QuickTest window visible



Set qtApp = Nothing ' Release the Application object





--------------------------------------------------------------------------------
Reply
#3
Solved: 11 Years, 3 Months, 3 Weeks ago
The following VBScript works for me:

Enter the following code in VBScript editor and save teh file(saves as a VBS file) then you can go to the CMD to run the VBS file or use windows scheduler to schedule for a particular time.This is just an example make sure to change the location of the test script.

'**************************************************************************
'The following script opens a test, configures run options and settings,
'runs the test, and then checks the results of the test run.
'**************************************************************************
Code:
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
Const ForReading = 1, ForWriting = 2
Dim fso, f, result

Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile("C:\Program Files\Mercury Interactive\QuickTest Professional\Tests\Regression_Test_Results.txt", ForWriting, True)

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.ImageCaptureForTestResults = "OnError"
qtApp.Options.Run.RunMode = "Fast"
qtApp.Options.Run.ViewResults = False
qtApp.Open "C:\Program Files\Mercury Interactive\QuickTest Professional\Tests\Regression_Suite_BA_1\CharitableOrg_Owner_NonQual_GuaDeathBenefit_SurrenderCharges", 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.OnError = "NextStep" ' Instruct QuickTest to perform next step when error occurs

'Set the results path
Set qtResultsOpt = CreateObject("QuickTest.RunResultsOptions") ' Create the Run Results Options object
qtResultsOpt.ResultsLocation = "C:\Program Files\Mercury Interactive\QuickTest Professional\Tests\Regression_Suite_BA_1\CharitableOrg_Owner_NonQual_GuaDeathBenefit_SurrenderCharges\Res1" ' Set the results location
qtTest.Run qtResultsOpt 'Run the test
result= qtTest.LastRunResults.Status
f.Write("Test 1: CharitableOrg_Owner_NonQual_GuaDeathBenefit_SurrenderCharges - ")
f.Write(result)
f.WriteBlankLines(1)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Test Set Run automatically Santhosh311 0 2,420 04-14-2016, 06:06 PM
Last Post: Santhosh311
  How to invoke browser without using OR alpha1 4 3,402 07-21-2015, 05:40 PM
Last Post: alpha1
  .vbs script error when trying to insert a value in a sapguitable frebuffi 5 6,825 07-18-2013, 03:04 PM
Last Post: Staff
  VBS to DLL to QTP ssco77 5 12,223 12-16-2011, 01:21 PM
Last Post: prashants1
  What is the best way to launch the browser soumya 4 3,194 12-12-2011, 12:20 PM
Last Post: v.swaminathan

Forum Jump:


Users browsing this thread: 1 Guest(s)