Quick test professional

QTP Tips QTP codes QTP Faqs and more

Upload Attachments To QC

Function UpLoadAttachmentToQC(FilePath)

Set ObjCurrentTest = QCUtil.CurrentTest.Attachments
Set ObjAttch = ObjCurrentTest.AddItem(Null)
ObjAttch.FileName = FilePath
ObjAttch.Type = 1
ObjAttch.Post
ObjAttch.Refresh

End Function
FilePath=”C:\abc.vbs”
Call UpLoadAttachmentToQC(FilePath)

Author: Mohan Kakarla

Source: QC-OTA

About these ads

September 24, 2008 - Posted by | Automating QC, QC-OTA

19 Comments »

  1. Hi Mohan,

    This is really Excellent site for the QTP Testers:-

    I have to (upload)attach screen shot in QC against some particular steps, if a condition is fulfilled I want to call that function and upload the attachment again the Test step in QC.

    Please have a look and let me know if you need more clarifications).

    Thanks

    Comment by Kamal | November 23, 2008 | Reply

    • Plz send me the code for attaching file to Testlab.
      my objective is to upload files after execution of all scripts(so i cant use QCutil.currentrun)..

      Thanks in advance.

      sakthivelraja

      Comment by Sakthivel Raja | October 26, 2009 | Reply

    • I am getting error for QC.util of object required i have qtp-Qc connection

      Comment by yogesh | December 30, 2011 | Reply

  2. Hi Mohan,

    Fantastic efforts!!

    I was able to upload attachment for the QCUtil.CurrentTest
    and QCUtil.CurrentRun. But I was not able to upload attachment for a particular ‘step’ in the ‘Run Steps’ Please guide thru.

    Many Thanks

    Comment by Abrakh | June 9, 2009 | Reply

    • Hi Abrakh,…i was tryin to upload an attachment using the currentrun object but the file uploaded is showing as 0 kb for me in qc….can you please share ur code for the current run object….

      Comment by abraham | December 11, 2011 | Reply

  3. Hi there,

    Well i am looking for the vb code to use in excel.

    My actual plan is to place a button in excel and once we click on the button the attachment of the excel file should get uploaded to selected test plan in the test lab module in the Quality Center.

    If u can provide me the code i would appreciate it.

    Thanks in Advance,

    Regards,
    Chatiu

    Comment by Chaitanya | August 18, 2009 | Reply

    • Hi,

      I also have similar requirement. Do you still have the solution with you?

      Thanks,
      Ipsita.

      Comment by Ipsita | November 22, 2010 | Reply

  4. Hello Mohan,

    Can you please help\guide me for an QTP script which creates User in Test Director (Quality Center).

    Regards
    Tahir

    Comment by Tahir | October 21, 2009 | Reply

  5. Hi Mohan,

    Thanks for your article,

    I wanted to know how to upload and download resources in resource module in QC Through QTP.

    Comment by soumyavinay | February 1, 2010 | Reply

  6. Hi Mohan

    Can u tell me how to get the “RUN NAME” in QC. i need to store the value in excel sheet.
    i have 10 test cases and i need to get all the RUN NAMEs and put it in an excel sheet.

    please help me in this

    Thanks
    Chandra

    Comment by Chandu | March 1, 2010 | Reply

  7. Hi Mohan,
    This is really very wonderfull and helpful collection for us.I need code to download manual test cases into local machine from QC ( i.e. Test Plan.).It will be great help.
    Thanks
    Dharmendra

    Comment by Dharmendra Sahu | April 14, 2010 | Reply

  8. Hi Mohan,

    Thanks for your article.
    I need one help.

    My requirement is, i have around 500 excel attachments to be attached to around 250 test plans. Thus each test would have 2 attachments. Could you help me out in writing a vbcode which would upload the attachments to QC automatically in 1 go.
    I am using QC 9.2 and Excel 2007.

    Thanks,
    Ipsita.

    Comment by Ipsita | November 22, 2010 | Reply

  9. Hi Mohan,

    This is a really Excellent site. I am visiting first time. Could you send me the code to upload attachments to Test Lab for each test condition. Thanks in advance

    Comment by Kalpana | January 7, 2011 | Reply

  10. Function UpLoadAttachmentToQC(FilePath)

    Set ObjCurrentTest = QCUtil.CurrentTest.Attachments
    Set ObjAttch = ObjCurrentTest.AddItem(Null)
    ObjAttch.FileName = FilePath
    ObjAttch.Type = 1
    ObjAttch.Post
    ObjAttch.Refresh

    End Function
    FilePath=”C:\abc.vbs”
    Call UpLoadAttachmentToQC(FilePath)

    this is fine ,and works with quality center 10.0 version.
    but to achieve the same task in quality center 9.0 version,we beed to use ObjAttach.save method also.
    so could you please tell me the difference between post and save method?

    Comment by sony | August 11, 2011 | Reply

  11. Hi Mohan,
    I have a requirment to copy multiple folder and files to QC.At runtime in the QTP11.0 Script I am storing the request and response xml in seperate folders based on the ServiceName and Service MethodName in my local folder .EX:C:\Services.Log So the Services.Log contains multiple folders with req and res for each service.After QTP Script Execution I want to upload all the folders and subfolders in the QC.Could you please help me how the code it.

    Comment by R K Kiran Kumar | February 28, 2012 | Reply

  12. I like what you guys are usually up too. This kind of clever work and coverage!

    Keep up the very good works guys I’ve you guys to our blogroll.

    Comment by web ressource | October 7, 2012 | Reply

  13. Mohan, Can we write a VBScript code to upload attachment to QC 11 [Test Resource] item?
    Can you give me a hint or code snippet for the same. I could only make connection till now.

    Comment by crazyjainAnil Jain | January 10, 2013 | Reply

  14. Wonderful blog! Do you have any tips for aspiring writers?
    I’m planning to start my own website soon but I’m a little lost on everything.
    Would you advise starting with a free platform like WordPress or go
    for a paid option? There are so many choices out there
    that I’m totally overwhelmed .. Any recommendations? Cheers!

    Comment by Hershel | March 15, 2013 | Reply

  15. Howdy would you mind letting me know which hosting company you’re using? I’ve loaded your web site
    in 2 different web browsers and I will have to say this blog site loads a lot
    faster then others. Can you recommend a good hosting company at a honest
    price? Kudos, I appreciate it! Plz also excuse if my english is not good enough.

    Comment by Josefina | March 23, 2013 | Reply


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 134 other followers

%d bloggers like this: