Function to upload UFT/QTP scripts in ALM/QC

As most of the organizations are moving to ALM/QC for automation scripts or many of them have already moved. 
Below function will help the people who are going to move all automation scipts to ALM/QC. 

Also need to take care of resources before uploading the scripts to ALM/QC as currently it will be using the local path but when uploaded to ALM/QC it will not work if you execute those scripts through ALM/QC on other testing hosts.

This function will open the test in QTP and perform save as in the QC folder path you provide. And will remove all functional libraries and will include which you specify.

RowCnt = <Number of tests>

ALMUrl =  <ALM URL>
ALMDomain = <ALMDomain>
ALMProject = <ALMProject >
ALMUserId = <ALMUserId >
ALMUserPwd = <ALMUserPwd >

Set objQTP = CreateObject("QuickTest.Application")
    If Not objQTP.TDConnection.IsConnected Then
        objQTP.TDConnection.Connect ALMUrl, ALMDomain, ALMProject, ALMUserId, ALMUserPwd, False
    End If
    
LocalFolderPath = <LocalFolderPath>
QCFolderpath = <QCFolderpath >
    
For i = 2 To RowCnt

LocalTest = LocalFolderPath  & "\" <Test name>
QCTest = "[ALM] " & QCFolderpath  & "\" & <Test name>

objQTP.Open LocalTest, False, False

Set objLib = objQTP.Test.Settings.Resources.Libraries
objLib.RemoveAll
'If the library is not already associated with the test case, associate it..
If objLib.Find("[ALM] Resources\[Functional library file name]") = -1 Then ' If library is not already added
  objLib.Add "[ALM] Resources\[Functional library file name]", 1 ' Associate the library to the test case
End If

objQTP.Test.SaveAs QCTest

Next



Comments

Post a Comment

Popular posts from this blog

UFT - Resolving scrolling issue if object is not visible

How to create a zip folder using VBScript

how to access the excel file as database in UFT?