Sending an email of Test Results : General Questions

Sending an email of Test Results

Ask general questions here.

Sending an email of Test Results

Postby smalldoorman » Tue Oct 12, 2010 6:55 pm

I have a solo system that is for Ranorex and it runs our test while I do other work on my machine. So far I have it execute several solutions back to back which can take anywhere between 30 min to several hours.

Is there any way to have Ranorex send me an email after each solution where the subject line will name the solution and then tell me if it passed or failed. Or even just tell me that that the solution (or whole battery of tests) has completed? I would need to send through an SMTP that requires authentication but im not sure how to go about any of this.

Is it even possible to have email's sent upon completion let alone making a subject line dependent on the outcome of a test?
smalldoorman
 
Posts: 14
Joined: Thu Aug 12, 2010 11:37 pm

Re: Sending an email of Test Results

Postby sdaly » Wed Oct 13, 2010 11:04 am

It is possible using .net, I use the method below to send emails, the test log can be added as an attachment too.

This method only works with an open SMTP server.....

Public Sub sendEmail(strSubject As String, strBody As String, strAttachmentPath As String)
If TestRunner.getSetting("emailEnable") = True Then
Try
'create new mail class with passed in params
Dim insMail As New system.Net.mail.MailMessage(New system.Net.Mail.MailAddress(TestRunner.getSetting("emailAddressFrom")), New system.net.Mail.MailAddress(TestRunner.getSetting("emailAddressTo")))
With insMail
'set the subject
.Subject = strSubject
'set the body
.Body = strBody
'add attachment
If strAttachmentPath <> "" and file.Exists(strAttachmentPath) Then .Attachments.Add(New system.Net.Mail.Attachment(strAttachmentPath))
End With
Dim smtp As New System.Net.Mail.SmtpClient
smtp.Host = TestRunner.getSetting("emailHost")
smtp.Port = 25
smtp.Send(insMail)
report.Info("Email", "Sent")
Catch ex As System.Exception
report.Failure("Email", ex.Message.ToString)
Throw New Exception("Exception")
End Try
End If
End Sub



If you need SMTP authentication take a look at sending emails using CDO - http://www.google.co.uk/search?sourceid ... %2enet+cdo

Hope this helps
Scott
User avatar
sdaly
 
Posts: 213
Joined: Mon May 10, 2010 12:04 pm
Location: Dundee, Scotland

Re: Sending an email of Test Results

Postby Support Team » Wed Oct 13, 2010 11:08 am

Hi,

Of course it is possible to customize your Report. Many of our customers use its own Reports. Please take a look to following blog for your issue. In this blog will be explained "How to customize your Report and send it via mail". http://www.ranorex.com/blog/customizing-ranorex-reports

Regards,
Peter
Ranorex Team
User avatar
Support Team
Site Admin
 
Posts: 4845
Joined: Fri Jul 07, 2006 5:30 pm
Location: Graz, Austria

Re: Sending an email of Test Results

Postby smalldoorman » Wed Oct 13, 2010 4:34 pm

Peter,
I ran across that tutorial after I posted this. Thing is, I'm still learning C# as I go and the tutorials written, although concise, do not help with telling me where each snippet is supposed to go.

For example I'm told to "right click on IReportLogger and select “MailLogger -> Implement Interface (implicit) -> IReportLogger” and Ranorex Studio will create stubs for the interface methods for you." But I cannot find the IReportLogger in the Studio and nothing comes up for IReport on the Ranorex website.

Are there anymore detailed steps as to what needs to go into what files at least?
smalldoorman
 
Posts: 14
Joined: Thu Aug 12, 2010 11:37 pm

Re: Sending an email of Test Results

Postby Support Team » Thu Oct 14, 2010 2:00 pm

Hi,

Please take a look at the sample project how we implemented the Custom Logger. Please click following link (link is also available in the blog):
http://www.ranorex.com/blog/wp-content/ ... ogging.zip
Save the zip file to your hard drive and extract it. Then please open the Ranorex Solution Project and take a look at the implementation.

Regards,
Peter
Ranorex Team
User avatar
Support Team
Site Admin
 
Posts: 4845
Joined: Fri Jul 07, 2006 5:30 pm
Location: Graz, Austria


Return to General Questions

Who is online

Users browsing this forum: No registered users and 0 guests

cron