cancel
Showing results for 
Search instead for 
Did you mean: 

Script Extensions Test Complete 11 - Email Logs from Keyword Test Run.

Contributor

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?

Thanks,

Here I can see how to send an email via gmail but no idea how to add the log as an attachment.
http://support.smartbear.com/viewarticle/9020/ 

3 REPLIES 3
Community Manager

Re: Script Extensions Test Complete 11 - Email Logs from Keyword Test Run.

Hi JBSoccerbrit,

 

The question about adding attachments to the message have already been discussed several times. Refer to the following topics for details:

http://community.smartbear.com/t5/Getting-Started-with/Adding-an-attachment-to-an-email-sent-via-CDO...

http://community.smartbear.com/t5/Functional-Web-Testing/Sending-EMail-Through-Script/td-p/58550

 

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Contributor

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).

Thanks,

Community Manager

Re: Script Extensions Test Complete 11 - Email Logs from Keyword Test Run.

Hi JBSoccerbrit,

 

The community discussions I mentioned are talking about the ways on how to add attachments to email messages. @sdruker uses the following code for this:

Public Function SendEmail(mFrom, mTo, mSubject, mBody, mAttachment)
 
  Dim i, schema, mConfig, mMessage, mAttach
  Err.Clear
  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)
  mConfig.Fields.Update
 
  Set mMessage = Sys.OleObject("CDO.Message")
  mMessage.Configuration = mConfig
  mMessage.MimeFormatted=true
  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)
   mMessage.Attachments.Item(1).ContentMediaType="application/octet-stream"
  Next
 
  mMessage.Send()
 
  If Err.Number > 0 Then
    Log.Error "E-mail cannot be sent", Err.Description
    SendEMail = False
  Else
    Log.Message "Message to <" + mTo + "> was successfully sent"
    SendEMail = True
 End If
 
End Function

 

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. ⬇️⬇️⬇️
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors