Dim qtp_app
Dim file_sys
Dim Dir
Dim test_collection
Set qtp_app = CreateObject("QuickTest.Application")
qtp_app.Launch
qtp_app.Visible = True
' The file_systemObject object is used to access the file system on the server. This object can manipulate files, folders, and directory paths.
Set file_sys = CreateObject("Scripting.filesystemObject")
'GetFolder: Returns a Folder object for a specified path
Set Dir = file_sys.GetFolder( "C:\Program Files\HP\QuickTest Professional\tests1" )
Set test_collection = Dir.SubFolders
'RunResultsOptions:A collection of properties that indicate preferences for the run results.
Set qtResultsObj = CreateObject("QuickTest.RunResultsOptions")
For each t_folder in test_collection
qtp_app. Open t_folder.Path, True, FalseNext
'Setting the location for the run results
qtResultsObj.ResultsLocation = t_folder.Path & "\Res1" ' Set the results location
' Execute the test. Instruct QuickTest Professional to wait for the test to finish executing.
qtp_app.Test.Run qtResultsObj, True
qtp_app.Test.Close
qtp_app.Quit
Set test_collection = Nothing
Set Dir = Nothing
Set file_sys = Nothing
Set qtp_app = Nothing