How to Upload a file to Quality Center (QC/ ALM)
Vote if this topic was useful to you
How to Upload a file to Quality Center (QC/ ALM)
'Assigning the Values to the variables or directly give them during calling the function as respective arguments.
QCFileName = "GajreResults" 'This is the Name of
the Resource in the Test Resource folder of QC--This should the available in QC.
LocalUploadFolder = "D:\Gajre\Test Execution Results" 'Local System Folder
LocalUploadFile = "ResultsLogfile.xls" 'File to be uploaded
QCResourceType = "Data table"
call UpLoadFileToQC(QCFileName,LocalUploadFolder,LocalUploadFile,QCResourceType)
Function UpLoadFileToQC(QCFileName,LocalUploadFolder,LocalUploadFile,QCResourceType)
On Error Resume Next
oSubFlag = false
Set oResourceFactory = QCUtil.QCConnection.QCResourceFactory
Set oRoot = oResourceFactory.NewList("")
Set oSub = Nothing
iTotalItems = oRoot.Count
For ItemCtr = 1 To iTotalItems
CurItem = oRoot.Item(ItemCtr).Name
If UCase(CurItem) = UCase(QCFileName) Then
Set oSub = oRoot.Item(ItemCtr)
oSubFlag = true
Exit for
End If
Next
Set oRoot = Nothing
Set oResourceFactory = Nothing
If oSubFlag Then
oSub.Refresh
oSub.FileName = LocalUploadFile 'This is the file Which is der in the UploadFolder Path
oSub.ResourceType = QCResourceType 'Example: oSub.ResourceType = "Data table"
oSub.Post
oSub.UploadResource LocalUploadFolder, true
Set oSub = nothing
End If
End Function
QCFileName = "GajreResults" 'This is the Name of
the Resource in the Test Resource folder of QC--This should the available in QC.
LocalUploadFolder = "D:\Gajre\Test Execution Results" 'Local System Folder
LocalUploadFile = "ResultsLogfile.xls" 'File to be uploaded
QCResourceType = "Data table"
call UpLoadFileToQC(QCFileName,LocalUploadFolder,LocalUploadFile,QCResourceType)
Function UpLoadFileToQC(QCFileName,LocalUploadFolder,LocalUploadFile,QCResourceType)
On Error Resume Next
oSubFlag = false
Set oResourceFactory = QCUtil.QCConnection.QCResourceFactory
Set oRoot = oResourceFactory.NewList("")
Set oSub = Nothing
iTotalItems = oRoot.Count
For ItemCtr = 1 To iTotalItems
CurItem = oRoot.Item(ItemCtr).Name
If UCase(CurItem) = UCase(QCFileName) Then
Set oSub = oRoot.Item(ItemCtr)
oSubFlag = true
Exit for
End If
Next
Set oRoot = Nothing
Set oResourceFactory = Nothing
If oSubFlag Then
oSub.Refresh
oSub.FileName = LocalUploadFile 'This is the file Which is der in the UploadFolder Path
oSub.ResourceType = QCResourceType 'Example: oSub.ResourceType = "Data table"
oSub.Post
oSub.UploadResource LocalUploadFolder, true
Set oSub = nothing
End If
End Function
Last edited by Gajre on Wed Oct 10, 2012 12:58 am; edited 1 time in total
Re: How to Upload a file to Quality Center (QC/ ALM)
You can upload any type of files based on the QC Resource Type.
for example to upload a library you will have to pass/ assign the "Function library" (please check in QC resource type and correct it the spelling is wrong) value to QCResourceType variable/ argument
Similarly to upload ObjectRepository or a .tsr file, pass/ assign the "Shared Object Repository" (please check in QC resource type and correct it the spelling is wrong) value to QCResourceType variable/ argument
so on for other resource types...
for example to upload a library you will have to pass/ assign the "Function library" (please check in QC resource type and correct it the spelling is wrong) value to QCResourceType variable/ argument
Similarly to upload ObjectRepository or a .tsr file, pass/ assign the "Shared Object Repository" (please check in QC resource type and correct it the spelling is wrong) value to QCResourceType variable/ argument
so on for other resource types...
Permissions in this forum:
You cannot reply to topics in this forum
Thu Jun 19, 2014 11:31 am by thomasdfg
» How to identify the object when it is dynamically changing behavior
Wed Jun 18, 2014 6:37 pm by thomasdfg
» Patches for QTP 10, 11, 11.5
Wed Jun 18, 2014 6:04 pm by thomasdfg
» Retrieving data from Txt file into datatable
Wed Jun 18, 2014 5:32 pm by thomasdfg
» VB Script to count number of links in a web page.
Wed Jun 18, 2014 4:51 pm by thomasdfg
» Customized HTML reports in QTP
Wed Jun 18, 2014 4:42 pm by thomasdfg
» how to print values into a field of a web page, from a data table in qtp?
Wed Jun 18, 2014 4:37 pm by thomasdfg
» How to delete cookies using QTP?
Wed Jun 18, 2014 4:30 pm by thomasdfg
» When UFT Does Not Identify an Object
Wed Jun 18, 2014 4:23 pm by thomasdfg