With the EmailModule, you can have your test send out an email at a desired point in the test run automatically and even attach the report to it. This is useful for getting notifications when a long test has reached a certain point or to automatically send out test results to several people.
Add the module
-
Simply drag the module from the module browser to the desired test container. Once the test run arrives at this point, it will send out the email as configured (see further below for mandatory configuration).
If you’ve configured the module to attach the report to the email, we recommend placing the module in the final teardown section of your test, so everything is done and all information is included in the report.
In the above image, the module was added to the teardown section of the test case Test_introduction_functions, after the module that closes the AUT. It is configured to send out an email informing us that the AUT has been closed.
Configure the module
The module contains 14 predefined variables. They are used to configure the module. Some of them are mandatory, others optional.
To use these variables for configuration, you need to either create a data source that contains possible configuration values or create parameters with these values. You then bind each value to the respective variable.
Data sources, parameters, and data binding are explained in Ranorex Studio fundamentals > Data-driven testing
Here are all the variables and which values they accept:
Subject
The subject line of the email.
Body
The main text of the email.
To
The email address of the recipient.
From
The email address of the account you want to send the email from.
ServerHostname
SMTP name of the email server used to send the email. These usually follow the pattern “smtp.myserver.com”. Please consult your company’s tech support if you are unsure which email server to use.
Remember that the machine you run the test on must have access to this email server, e.g. be in your company’s network domain and have the correct rights.
ServerPort
The port the email server will use to send the email. This is usually port 25. Please consult your company’s tech support if you are unsure which port to use.
UseSSL
Whether to use SSL encryption. Possible values: true, false.
Username
Username for the email account used to send the email from. Normally not needed if the machine you run the test on is in the email server’s network domain and already logged into the email account, e.g. in Microsoft Outlook.
Password
Password for the email account used to send the email. See Username for more information.
SendEmailOnFailure
Only sends the email if a failure has occurred at a point before the module. Possible values: true, false.
SendEmailOnSuccess
Only sends the email if no failures have occurred before the module. Possible values: true, false.
SendZippedReportOnComplete
It attaches the test report as a ZIP file. Possible values: true, false.
SendPdfReportOnComplete
It attach the test report as a PDF file. Possible values: true, false.
PdfReportCustomStylesheet
Path to an XSL stylesheet you want to use to customize the PDF test report.
Result
After running a test with the module, the report contains a log entry that also indicates whether a report was attached to the email.