Export xls File to QC from QTP

Question ID: 104193

I am wondering how I might export a xls or csv file to Quality Center. Ideally I would like to upload it as an attachment to a folder within the test plan module. Any advise would be greatly appreciated.

Ultimatley I will need to be able to import this file back into QTP. I am able to do that now using this syntax: DataTable.Import "[QC-ATTACH];;Subject\\TestPlanFolderName;;\\temp.xls"

And I do not know how that would vary for pulling a file from the test resource module.

Thank you!

Marked as spam
Posted by (Questions: 2, Answers: 1)
Asked on August 12, 2010 9:33 pm
Answers (1)
Private answer

It is possible using HP OTA (Open Test Architecture). I haven't got any code samples which does exactly what you need but here is something which should get you started.

This code can be executed from within QTP script and will connect to QC server and display details of all attachments for the defect with ID 1.

OTA documentation can be found on the QC help page.

Set QCConnection = CreateObject(''TDApiOle80.TDConnection'')

QCConnection.InitConnectionEx ''''
QCConnection.ConnectProjectEx ''DEFAULT'', ''MyProject'', ''qc_admin'', ''admin''

Set bf = QCConnection.BugFactory
Set bugList = bf.NewList('''')

'Retrive all attachemnts of the defect with ID 1 and iterate through them
For Each Attachment In bugList(1).Attachments.NewList('''')

    msgbox ''Description: '' & Attachment.Description & vbNewLine &_
        ''DirectLink: '' & Attachment.DirectLink & vbNewLine &_
        ''Name 0: '' & Attachment.Name(0) & vbNewLine &_
        ''Name 1: '' & Attachment.Name(1) & vbNewLine &_
        ''Name 2: '' & Attachment.Name(2) & vbNewLine &_
        ''ServerFileName: '' & Attachment.ServerFileName

    MsgBox ''Name: '' & Attachment.Name(0) & vbNewLine & _
        ''Len: '' & Attachment.Data(10)


Marked as spam
Posted by (Questions: 0, Answers: 2)
Answered on August 19, 2010 2:56 pm