Script Extensions Test Complete 11 - Email Logs from Keyword Test Run.
I've glossed over the documents in Test Complete 11 and see where it mentions creating Script Extensions to be used in Keyword Tests to send email for Keyword Test log results. I've never actually written one myself and was wondering if there is already a pre-existing plugin/app that exists or if anyone has any examples?
Re: Script Extensions Test Complete 11 - Email Logs from Keyword Test Run.
Hi Tanya unfortunately neither of the links you provided really answer my question, or not to the point of where I understand how they answer my question specifically.
I'm looking for more of a guide.
Example; 1) select call object method 2) pick slpacker - What selections should be made here to grab the log files and put them in the correct extension type? 3) select run code snippet - I'm assuming here I attempt to use one of the 3 methods available to send the email (SendMail which is built in, CDO or outlook).
Public Function SendEmail(mFrom, mTo, mSubject, mBody, mAttachment)
Dim i, schema, mConfig, mMessage, mAttach
On Error Resume Next
schema = "http://schemas.microsoft.com/cdo/configuration/"
Set mConfig = Sys.OleObject("CDO.Configuration")
mConfig.Fields.Item(schema + "sendusing") = 2 ' cdoSendUsingPort
mConfig.Fields.Item(schema + "smtpserver") = "SMTP server" '
'mConfig.Fields.Item(schema + "smtpserver") = "ServerName" ' SMTP server
mConfig.Fields.Item(schema + "smtpserverport") = 25 ' Port number
mConfig.Fields.Item(schema + "smtpauthenticate") = 1 ' Authentication mechanism
' mConfig.Fields.Item(schema + "sendusername") = "" ' User name (if needed)
' mConfig.Fields.Item(schema + "sendpassword") = "" ' User password (if needed)
Set mMessage = Sys.OleObject("CDO.Message")
mMessage.Configuration = mConfig
mMessage.From = mFrom
mMessage.To = mTo
mMessage.Subject = mSubject
mMessage.HTMLBody = mBody
aqString.ListSeparator = ","
For i = 0 To aqString.GetListLength(mAttachment) - 1
mMessage.AddAttachment aqString.GetListItem(mAttachment, i)
If Err.Number > 0 Then
Log.Error "E-mail cannot be sent", Err.Description
SendEMail = False
Log.Message "Message to <" + mTo + "> was successfully sent"
SendEMail = True
If you want to attach the current test log, you will need to save it first. For this, you can use the Log.SaveResultsAs method. Please refer to the "SaveResultsAs method" article ( http://support.smartbear.com/viewarticle/75301/ ) for more information.
Does it clarify the situation?
--------- Tanya Gorbunova SmartBear Community Manager
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️