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

End Function
Call UpLoadAttachmentToQC(FilePath)

Author: Mohan Kakarla

Source: QC-OTA


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

Remove Attachment from QC Through QTP

‘The following function will Remove the specified attachment  from the current test of QC when  the file name provided
Function RemoveQCAttachements(NameOfTheFile)
var_count= QCUtil.CurrentTest.Attachments.NewList(“”).count
For i= 1 to var_count

 If   QCUtil.CurrentTest.Attachments.NewList(“”).Item(2).Name =NameOfTheFile Then
         AttachmentID = QCUtil.CurrentTest.Attachments.NewList(“”).Item(1).ID
     Reporter.ReportEvent micFail,”Please provide the valid filename with extention”,”Please provide the valid filename with extention”
 End If

End Function

NameOfTheFile=”abc.vbs” ‘Provide the file name with extension
call RemoveQCAttachements(NameOfTheFile)

Author:Mohan Kakarla

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