Ranorex 7.2 - Send Email/PDF Only On Failure

Class library usage, coding and language questions.
Wayne_Fletcher
Posts: 10
Joined: Thu May 05, 2016 10:16 am

Ranorex 7.2 - Send Email/PDF Only On Failure

Post by Wayne_Fletcher » Tue Oct 24, 2017 2:23 pm

Hello

Using Ranorex 7.2

I've worked out how to use the automation helpers to convert the report to a PDF and use the Send Email helper - inserting User Code into a module so that I Send-Email as command to attach the PDF - to send it in an email with an attached PDF.

The above I do in the tear down section.

What I would really like to do is only send the email on failure but this is really alluding me - the justification is my Manager only wants to see the failures . Does anybody have a way do doing this?

Thanks.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Ranorex 7.2 - Send Email/PDF Only On Failure

Post by Support Team » Tue Oct 24, 2017 5:03 pm

Hi Wayne,

You can do this by adding the following line just below Report.End(); in the EmailModule

Code: Select all

if (Ranorex.Core.Reporting.TestReport.CurrentTestSuiteActivity.TotalFailedTestCaseCount > 0)
     return;
[/color]
UPDATE: See my post below on the new proper method to achieve this.

Cheers,
Ned
.
Image

Wayne_Fletcher
Posts: 10
Joined: Thu May 05, 2016 10:16 am

Re: Ranorex 7.2 - Send Email/PDF Only On Failure

Post by Wayne_Fletcher » Wed Oct 25, 2017 12:09 pm

Will test it - Thanks

loonquawl
Posts: 50
Joined: Wed Nov 22, 2017 10:08 am

Re: Ranorex 7.2 - Send Email/PDF Only On Failure

Post by loonquawl » Wed Jan 24, 2018 9:26 am

2018-01-24 09_23_57-Greenshot.png
excerpt from EmailModule
2018-01-24 09_23_57-Greenshot.png (22.58 KiB) Viewed 650 times
The EmailModule seems to have changed - could someone comment on where that code snippet is supposed to go now? (I guess (1) or (2)?)

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Ranorex 7.2 - Send Email/PDF Only On Failure

Post by Support Team » Wed Jan 24, 2018 8:39 pm

Hi loonquawl,

The above code is obsolete as this feature has since been implemented as a bound variable. Simply set "SendEmailOnFailure" as True and "SendEmailOnSuccess" as False to email the report only on failure.
emailmodule.png
emailmodule.png (6.69 KiB) Viewed 644 times
Cheers,
Ned
.
Image