Question about Send email module - body with report summary possible?

Ask general questions here.
BlindJones
Posts: 38
Joined: Fri May 17, 2019 7:10 am

Question about Send email module - body with report summary possible?

Post by BlindJones » Wed Sep 02, 2020 7:31 am

Hello everyone!

We are using the send email module in our solutions and my boss asked me, whether it is possible to create a notification email without an attached pdf or zipped report. He only wants to see the summary of the test suite in the email body to see at the first glance, how many test cases failed in that suite. As in this screenshot (of a beginning of a report) attached to this post.

Is there any way to realize that?

Thanks a lot!

BlindJones
Attachments
Report_Screenshot.png
Report Header
Report_Screenshot.png (12.15 KiB) Viewed 101 times

BlindJones
Posts: 38
Joined: Fri May 17, 2019 7:10 am

Re: Question about Send email module - body with report summary possible?

Post by BlindJones » Thu Sep 10, 2020 8:59 am

So, since nobody knows an answer, would it be possible to generate a pdf file with only the summary on top?
I know I can set the details to "none", but the performed recordings are still displayed in the pdf...

Can I change some code in "ReportToPDFModule" to create a PDF with only the summary?

Thank you everyone. :)

Kind regards
BlindJones

BlindJones
Posts: 38
Joined: Fri May 17, 2019 7:10 am

Re: Question about Send email module - body with report summary possible?

Post by BlindJones » Mon Sep 14, 2020 9:28 am

Good morning,

I managed now to get rid of some unwanted information in the pdf (sent by mail) by configuring the custom-style.xml (see attachment PDF_first_page).

Sadly, there are still more pages created with informations regarding the testsuites and the recordings (see attachment PDF_second_page)...

Is it possible to get rid of that informations? So only the first page of the PDF is created? Can I configure the XML - file accordingly?
Or maybe make some changes to the Emailmodule.cs in Ranorex?

Thank you for the help.

Best regards
BlindJones
Attachments
PDF_second_page.png
PDF_second_page.png (39.51 KiB) Viewed 50 times
PDF_first_page.png
PDF_first_page.png (46.86 KiB) Viewed 50 times
Custom_XML.png
Custom_XML.png (54.2 KiB) Viewed 50 times

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 6180
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Question about Send email module - body with report summary possible?

Post by odklizec » Mon Sep 14, 2020 9:47 am

Hi,

I'm afraid, I'm not using PDF at all, so I can't help you with this. But you should be able to extract test suite status via API.

Code: Select all

var tcStatus = Ranorex.Core.Reporting.ActivityStack.Current.Status; // returns test suite status
Eventually, you can use this for particular test case(s):

Code: Select all

var tcStatus = TestSuite.Current.GetTestContainer("tcName").Status; // get status of specified TC

Of course, it should be possible to get also other test case/suite details via API.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

BlindJones
Posts: 38
Joined: Fri May 17, 2019 7:10 am

Re: Question about Send email module - body with report summary possible?

Post by BlindJones » Mon Sep 14, 2020 10:12 am

odklizec wrote:
Mon Sep 14, 2020 9:47 am

Code: Select all

var tcStatus = Ranorex.Core.Reporting.ActivityStack.Current.Status; // returns test suite status
Hi Pavel,

that sounds really great. Do you know how to bring this information into the email body? To report there the content of a variable? Then maybe we don´t need to send a whole PDF by mail...

Thank you very much! :)

Best regards
Sebastian

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 6180
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Question about Send email module - body with report summary possible?

Post by odklizec » Mon Sep 14, 2020 10:23 am

Hi,

Well, I'm not using integrated emailing as well :D So I can only guess that there must be a way to fill certain aspects of email via variables? So you must first get the informations you want, store them in variables (SmartFoer/TestCase/Suite parameters) and use them in email method?
How exactly do you implement emailing in your project?

BTW, the status method I posted must be called in program.cs. It will not return test suite status if used anywhere in the test suite (e.g. Test Suite TearDown section).
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

BlindJones
Posts: 38
Joined: Fri May 17, 2019 7:10 am

Re: Question about Send email module - body with report summary possible?

Post by BlindJones » Mon Sep 14, 2020 10:59 am

Hi,

since I am not so deep into C#, I use the predefined "sendemailmodule" provided by Ranorex.
And just fill up the predefined variables with my content (as shown in the screenshot).

I tried to copy your code into the "program.cs", but the solution will not work any longer then. And I really don´t know how to use that variable then to generate a email body with the status.

It´s very complicated when you are not able to code... :cry:

Best regards
Sebastian
Attachments
SendEmailBinding2.png
SendEmailBinding2.png (45.89 KiB) Viewed 39 times

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 6180
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Question about Send email module - body with report summary possible?

Post by odklizec » Mon Sep 14, 2020 11:52 am

Hi,

You need to place the code in program.cs, as shown here:
testsuite-fails-but-activitystack-statu ... tml#p55894

I'm afraid, successful TA without, at very least, basic knowledge of coding is just a myth. But guess what? I'm not programmer at all and all I know about C# is from using Ranorex :D So don't worry and keep automating!
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

BlindJones
Posts: 38
Joined: Fri May 17, 2019 7:10 am

Re: Question about Send email module - body with report summary possible?

Post by BlindJones » Mon Sep 14, 2020 12:22 pm

Hi,

thank you, I added the line of code successfully in the program.cs :)

But now I wonder how to use the variable "tcStatus" in the "emaimodule.cs".

With "Report.tcStatus"? :?:

Best regards
Sebastian

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 6180
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Question about Send email module - body with report summary possible?

Post by odklizec » Mon Sep 14, 2020 12:30 pm

Hi,

I'm not quite sure if Ranorex helpers implementation of sending emails is usable in this scenario, because the code I suggested is actually called after the email is sent. I think you will have to implement email sending via SendMail.cs module, as discussed here:
send-mail-module-t2356.html
I believe that email sending via Ranorex helpers uses part of SendMail module? You will just have to implement sending emails via program.cs. But as I mentioned, I'm not sending emails via Ranorex tests, so I can be completely wrong ;)
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration