VB Script || QC Code || QTP || Upload an attachment file and Send attachment file in mail from test plan automatically.
Below is the code that i used for sending mail from Quality Centre to the recipient list.The attachment is sent from Test Plan.
FilePath = "" 'File Path where your file is located.
Call UpLoadAttachmentToQC(FilePath) ' Call the function to upload the attachment
Function UpLoadAttachmentToQC(FilePath)
Set ObjCurrentTest = QCUtil.CurrentTest.Attachments 'Creating QC Util Object with attachment
Set ObjAttch = ObjCurrentTest.AddItem(Null) 'Object for Current Test Set
ObjAttch.FileName = FilePath 'Attaching the File in the Object
ObjAttch.Type = 1
ObjAttch.Post 'Post your Attachment to the QC
ObjAttch.Refresh 'Refresh the Object
Set attachFact = QCUtil.CurrentTest.Attachments
'Here i have created attachment factory object which is associated with QC and it will fetch all the attachment from the current Test Plan and store it in attachList array of element.
Set attachList = attachFact.NewList("")
ReDim Preserve AttachmentList(attachList.Count - 1)
Dim i
i = LBound(AttachmentList)
'Running loop for each attachment and uploading them from QC to an array.
For Each theAttachment In attachList
AttachmentList(i) = theAttachment.ServerFileName
i = i + 1
Next
Dim fName
For Each fName In AttachmentList
MsgBox "The AttachmentList element is: " & fName
Next
Mailto = "abc@domainname"
'Use the send mail method of Quality Centre to sent mail to the concerned authorities with Attachment list array.
QCUtil.QCConnection.SendMail Mailto,,,,AttachmentList
End Function
FilePath = "" 'File Path where your file is located.
Call UpLoadAttachmentToQC(FilePath) ' Call the function to upload the attachment
Function UpLoadAttachmentToQC(FilePath)
Set ObjCurrentTest = QCUtil.CurrentTest.Attachments 'Creating QC Util Object with attachment
Set ObjAttch = ObjCurrentTest.AddItem(Null) 'Object for Current Test Set
ObjAttch.FileName = FilePath 'Attaching the File in the Object
ObjAttch.Type = 1
ObjAttch.Post 'Post your Attachment to the QC
ObjAttch.Refresh 'Refresh the Object
Set attachFact = QCUtil.CurrentTest.Attachments
'Here i have created attachment factory object which is associated with QC and it will fetch all the attachment from the current Test Plan and store it in attachList array of element.
Set attachList = attachFact.NewList("")
ReDim Preserve AttachmentList(attachList.Count - 1)
Dim i
i = LBound(AttachmentList)
'Running loop for each attachment and uploading them from QC to an array.
For Each theAttachment In attachList
AttachmentList(i) = theAttachment.ServerFileName
i = i + 1
Next
Dim fName
For Each fName In AttachmentList
MsgBox "The AttachmentList element is: " & fName
Next
Mailto = "abc@domainname"
'Use the send mail method of Quality Centre to sent mail to the concerned authorities with Attachment list array.
QCUtil.QCConnection.SendMail Mailto,,,,AttachmentList
End Function
Please provide me the VB script for uploading an attachment to Quality Center Test Lab without using QTP
ReplyDeletepreebhu@gmail.com
ReplyDeleteEven I am looking for this script, could you please send it to gouthamjerry@gmail.com
ReplyDeleteIam looking for vbscript to upload attachments into requirements in alm
ReplyDeleteGet the Best AWS Certification Training in Chennai from Infycle Technologies, the best software training institute, and Placement center in Chennai which is providing professional software courses such as Data Science, Artificial Intelligence, Cyber Security, Big Data, Java, Python, Digital Marketing, Hadoop, Selenium, Android, and iOS Development, DevOps, Oracle, etc with 100% hands-on practical training. Dial 7502633633 to get more info and a free demo and to grab the certification for having a peak rise in your career.Grab AWS Certification Training in Chennai | Infycle Technologies
ReplyDelete