• Register
Win an IPAD!!! Checkout this page!
x

Attatch to Test Resources in QC

0 votes
Hi,

How can we upload attachments to Test Resources in Quality Center using QTP?

Function UploadToQC(ResourceName,ResourceType,FolderName,FileName)
Set ObjResource = QCUtil.QCConnection.QCResourceFolderFactory
Set ObjResourceAddItem = ObjResource.Root.QCResourceFactory.AddItem(ResourceName)
ObjResourceAddItem.ResourceType =ResourceType
ObjResourceAddItem.ParentID =1
ObjResourceAddItem.FileName = ResourceName
ObjResourceAddItem.Post
Set ObjUtilityConnection=QCUTIL.QCConnection
Set ObjResourceFactory = ObjUtilityConnection.QCResourceFactory
Set ObjRoot = ObjResourceFactory.NewList("")
ObjRoot.Post
iTotalItems = ObjRoot.Count
For ItemCtr = 1 To iTotalItems
CurItem = ObjRoot.Item(ItemCtr).Name
If UCase(CurItem) = UCase(ResourceName) Then
Set oSub = ObjRoot.Item(ItemCtr)
Exit For
End If
Next
oSub.Filename = FileName
oSub.ResourceType = ResourceType
oSub.Post
oSub.UploadResource FolderName, True
Set oSub = Nothing
Set ObjRoot = Nothing
Set ObjResourceFactory = Nothing
End Function

Ex: UploadToQC "Env Folder2221112","Environment variables", "C:\Documents and Settings\xxxxxx\Desktop","123.xml"
Note:
Resource Type= Data table or Environment variables or Function library or Shared Object Repository
Resource Name=Resource name under resource folder
FolderName=Name of the Folder
FileName=Name of the File
Parent Id=1 means attachment will be uploaded to first resource folder name under Test resopurces

Please let me know if you need further clarification.

Regards,
Venkat.Batchu
asked Apr 24, 2012 by anonymous  
    

Your answer

Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.

...