EmailModule & variables & parameters...

Ask general questions here.
SanMan
Posts: 151
Joined: Tue Apr 13, 2010 9:59 am

EmailModule & variables & parameters...

Post by SanMan » Thu Apr 05, 2018 8:31 am

Hi,

Goal is that after testrun I send an email about test result.
I have added the EmailModule to [TEARDOWN] and I get the email and attachment after testrun.

I have a few questions / problems

1. Should I add the username&password (using GMAIL) to Global parameters? (see attachment)

2. As I have now the data in "Value" field (password also), it is shown in testreport when Global parameters are listed; how to get rid of that?

3. How can I get e.g. testrun date to be added to Subject?

4. Is it possible to get testrun fails or some other data to be added to body?

I hope someone understand my problems...
Attachments
pic1.PNG
pic1.PNG (5.89 KiB) Viewed 219 times

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

Re: EmailModule & variables & parameters...

Post by odklizec » Thu Apr 05, 2018 9:04 am

1. Should I add the username&password (using GMAIL) to Global parameters? (see attachment)
Either this or you can pass the user name/password via command line parameters instructing Ranorex to fill given global parameters with new values. See this User Guide paragraph about command line arguments:
https://www.ranorex.com/help/latest/les ... orexStudio
2. As I have now the data in "Value" field (password also), it is shown in testreport when Global parameters are listed; how to get rid of that?
I'm afraid, there is currently no way to mask the Global Parameters in report. The only way how to mask data displayed in report, is to use Data Connector, in which you can specify, which entries should be masked in report. Anyway, if you are worrying about user name/password, you are probably using a personal account for testing? This is a big mistake. You should never use sensitive data for testing purposes! Just create a dummy email for TA purposes.
3. How can I get e.g. testrun date to be added to Subject?
You can use DateTime method to get the current date/time...

Code: Select all

string dateFormat = "dd/MM/yyyy";
//get actual date
System.DateTime curDate = System.DateTime.Today; 
//convert date to string
string curDateStr= curDate.ToString(dateFormat); 
4. Is it possible to get testrun fails or some other data to be added to body?
Sure, you can get the test case/suite status using these lines...

Code: Select all

var tcStatus = TestSuite.Current.GetTestContainer("tcName").Status; // get status of specified TC 
var tcStatus = Ranorex.Core.Reporting.ActivityStack.Current.Status; // returns test suite status
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

SanMan
Posts: 151
Joined: Tue Apr 13, 2010 9:59 am

Re: EmailModule & variables & parameters...

Post by SanMan » Thu Apr 05, 2018 9:21 am

Thank you so much for a quick answer!

1. & 2. Yes, I did create a dummy email and no big problem here. And good to know that I can utilize command line.

3. & 4. Date method I have been using but new information about test case/suite status, thanks.

Now the most stupid question :oops:

How do I add (e.g. date to email subject). I have read (and even using variables little), but if you could give a simple example how to add the date to email subject.

Limited knowledge about C#; should I somehow call this
Ranorex.AutomationHelpers.Module.EmailModule.Subject variable and pass the data there?