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
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
QCUtil.CurrentTest.Attachments.RemoveItem(AttachmentID)
Else
Reporter.ReportEvent micFail,”Please provide the valid filename with extention”,”Please provide the valid filename with extention”
End If
AttachmentID = QCUtil.CurrentTest.Attachments.NewList(“”).Item(1).ID
QCUtil.CurrentTest.Attachments.RemoveItem(AttachmentID)
Else
Reporter.ReportEvent micFail,”Please provide the valid filename with extention”,”Please provide the valid filename with extention”
End If
Next
End Function
End Function
NameOfTheFile=”abc.vbs” ‘Provide the file name with extension
call RemoveQCAttachements(NameOfTheFile)
call RemoveQCAttachements(NameOfTheFile)
No comments:
Post a Comment