How can I run QTP test without manually launching the tool

Here is a simple Vb-script that will do the following:
  • Check if the test exists
  • Launch QTP and Open the test
  • Make QTP run in the minimized mode
  • Run the test and save the results
  • Close QTP  
testResourcePath = "C:\TestResults\"
testPath = "C:\TestPath\" 
'Determining that the test does exist
Dim objFSO
Set objFSO = CreateObject("Scripting.FileSystemObject")
DoesFolderExist = objFSO.FolderExists(testPath)
Set objFSO = Nothing

If DoesFolderExist Then
    Dim qtApp 'Declare the Application object variable
    Dim qtTest 'Declare a Test object variable
    Set qtApp = CreateObject("QuickTest.Application") 'Create the Application object
    qtApp.Launch 'Start QuickTest
    qtApp.Visible = True
    qtApp.WindowState = "Minimized"
    qtApp.Open testPath, False 'Open the test in read-only mode
    Set qtTest = qtApp.Test

    'Set qtResultsOpt = CreateObject("QuickTest.RunResultsOptions") 
    'qtResultsOpt.ResultsLocation = testResourcePath ' Specify the location to save the test results.
    'qtTest.Run qtResultsOpt,True 'Run the test and wait until end of the test run
    qtTest.Run 'Run the test
    qtTest.Close 'Close the test
    msgbox "Too Bad - Couldn't find the test folder"
End If
Use a windows Scheduler to schedule it from here on. 


Popular posts from this blog

XPATH for IE / internet explorer

RPA - Blue Prism, OpenSpan, Automation Anywhere vs UIPath