Saturday, January 16, 2010

Script to Upload Attachment To QC

Hi All,
Here I am providing the way of uploading an attachment into Quality Center programmatically using "QC OTA" API.

Note: QuickTest should be connected to a Quality Center server before executing below code.
Dim ObjCurrentTest,ObjAttch
Set ObjCurrentTest = QCUtil.CurrentTest.Attachments
Set ObjAttch = ObjCurrentTest.AddItem(Null)
ObjAttch.FileName = "C:\...\SampleTestResults.xls"
ObjAttch.Type = 1

After the above execution, 'xls' file would be attached to current Testscript 'Attachments' Section in QC.


  1. Hi,

    Nice Script...

    Can you write a script to

    1. Connnect with QC
    2. Enter with particular credentials
    3. Select Test Lab and Select desired Folder
    4. Select that Test Script and download the steps into XL Sheet.

    and Can we upload records available in XL Sheet to the QC.

    Above you write a script to attach a file. But, I need to upload the steps from XL to the Test Plan or Test Lab.

    Thanks & Regards,
    Baba Fakruddin.D

  2. Baba,

    Use the Excel Add-in to send test steps from XL to QC Test Plan. You won't be able to send things into Test Lab though, only Requirements, Test Plan and Defects. Unless they decide to come out with a better XL Add-in.

  3. Hi,
    Is there a way to attach file/snapshot to current running step during run time in Scripting?


  4. Really Good blog post.provided a helpful information.keep updating...
    Digital marketing company in Chennai

  5. Hello ,

    I want to attach word doc file to QC Test Lab, tried with above code unable to attach the word file.please help me to solve this issue.