Convert QTP Test Files from one Version to another

'*************************************************************************'
Description:
'
'This example specifies a folder in which tests from an older QuickTest version are
'stored and then loops through each test in the folder (and its subfolders) to open
'each one and save it in the current version format.
'
'***************************************************************************

Dim qtApp 'As QuickTest.Application ' Declare the Application object variable
Dim filesys
Dim maindir
Dim testCol
Dim checkfolder

' Create the QuickTest Professional object
Set qtApp = CreateObject("QuickTest.Application")
qtApp.Launch
qtApp.Visible = True

' Get the collection of test scripts
Set filesys = CreateObject("Scripting.FileSystemObject")

' TO DO: Sepecify the test script directory....
Set maindir = filesys.GetFolder("C:\temp")
Set testCol = maindir.SubFolders

' Loop through each test in the collection
For Each fl In testCol

    ' Verify the folder is a QTP test
    checkfolder = fl.Path & "\Action0"
    If (filesys.FolderExists(checkfolder)) Then ' The folder is a QTP test folder

       ' Convert test
       qtApp.Open fl.Path, False, False

       ' wscript.sleep 1000

       ' Save converted test
       qtApp.Test.Save

    End If
Next

qtApp.Quit

' Release the File System Objects
Set testCol = Nothing
Set maindir = Nothing
Set filesys = Nothing

' Release the QuickTest Professional application object
Set qtApp = Nothing

 The code above will make a set of sript test files work into a new version of the qtp. It just upgrades the script version compatibilty.

For gaining more insights in the automation using QTP log on to below url :

Automation Testing Using QTP

Post a Comment

Previous Post Next Post