Generative AI-Based Testing Certification
Generative AI-Based Testing Certification
Dealing with Emails
testRigor supports sending emails as well as receiving and validating emails. Although users can send emails to any domain they wish, in order to use testRigor’s built-in email validations (e.g., check that email from "[email protected]" is delivered
), emails must be sent to our proprietary domain @testrigor-mail.com
.
You can specify both “from” and “to”, but that’s not necessary. If “from” wasn’t specified – address will default to “[email protected]”
send email to "[email protected]" with subject "Test" and body "Hi, this is a test"
check that email from "[email protected]" is delivered
Checking email will also automatically open the email in a new tab and render it as an HTML page.
Note that, if more than one email is sent to the same address, validations need to mention either the exact number or that more than one email was sent. Otherwise, the validation will fail. See examples below:
Note that, if more than one email is sent to the same address, validations need to mention either the exact number or that more than one email was sent. Otherwise, the validation will fail. See examples below:
check that two emails to "[email protected]" and "Confirm" in subject were delivered
check that one or more emails to "[email protected]" and "Confirm" in subject were delivered
check that email to saved value "newEmail" was received
check that email to saved value "newEmail" from "[email protected]" and "Confirm" in subject was received
check that email to saved value "newEmail" and "<regular expression>" in subject was received
When running a test case on a mobile device, emails are still rendered in HTML in a desktop web browser by default. If you are executing a test case on a mobile device and need to render the message on that device (e.g., when validating a sign up test case, or just need to validate how the email will look like on a mobile device), you can specify rendering on the mobile device:
check that email to "[email protected]" and "Confirm" in subject was received and show in mobile
In some cases, you might also need to verify that an email was not sent out:
check that email from "[email protected]" was not delivered
testRigor also supports attachments, both from a URL as well as from a saved value (from Test Data section in the main menu). Both “from” and “to” addresses can be filled in from a saved value as well.
send email from "senderEmail" to "recepientEmail" with subject "Test", and body "Hi, this is a test", and attachment from saved value "Sample File"
send email from "[email protected]" to "[email protected]" with subject "Test", and body "Hi, this is a test", and attachment "http://online.com/file/name.pdf"
Notes:
-
If the email count is not specified, testRigor will assume that only one message is expected. Multiple emails are treated as an error; so in order to avoid receiving the error message, specify the number of emails that should be expected or simply inform the system that more than one can be sent out:
check that one or more emails to saved value "recepientEmail" were received
- The best practice is to always generate a new unique email address, since an email sent in one test case can be be checked by another test case if they have the same address.
generate unique email, then enter into "Email" and save as "newEmail"
– This produces an email of 30 random characters ending in the testrigor-mail.com domain.generate from template "$******************************@testrigor-mail.com", then enter into "Email" and save as "newEmail"
– This allows users to combine static values with symbols that generate dynamic values.- Commands to generate values can be used without entering the generated email into a field:
generate from template "*********@testrigor-mail.com" and save it as "newEmail"
- Users can also generate testrigor-mail.com email addresses by concatenating values and variables. For example, some users want to have a similar name with only minor variations that also divulge when the test case or username was created, so they have a static value and concatenate it with a timestamp as follows:
save string with parameters "username${nowUnixTime}@testrigor-mail.com" as "newEmail"
- If you want to send out an email from a customer’s domain and validate it, you can use the following address: <user>@testrigor-mail.com, where <user> can be any string. In order to avoid overlap it is recommended that the user handle will contain the customer name and some random part, e.g. [email protected].
-
The wait time in which the email is expected to arrive can be adjusted in
Settings
->Speed optimizations
->Timeouts and delays
->Email maximum wait time, seconds:
. - Adding multiple emails will be marked as an error, but each one will be rendered in a separate tab. You can switch between tabs using
switch to tab "1"
,switch to tab "2"
, etc. Note that old content will stay in the tab before the first rendered email message. In most cases, it is tab “1”, unless you open more tabs. -
Each email tab is rendered as an html page, so you can use any action that you would use on an html page. There are a few useful element ids that will help getting specific parts of an email:
- “message-froms” – a list of “From” addresses (usually one address)
- “message-subject” – subject line
- “message-date” – message sent date and time in Pacific Time zone.
- “message-tos” – a list of “To” addresses
- “message-ccs” – a list of “CC” addresses
- “message-bccs” – a list of “BCC” addresses
- “message-reply-to” – “Reply To” address
- “message-text” – the message text
- “message-attachments” – a list of attachments (file names only)
check "message-subject" contains "test"
- Once an email action has been successfully validated, the message is deleted from the mailbox. If you want to check again, you need to re-send the mail.
-
An email can be sent to multiple recipients by adding “and”:
send email to saved value "newEmail" and saved value "newEmail_2" with subject "Test" and body "Hi"
- All messages sent to @testrigor-mail.com will be deleted after 24 hours, whether checked or not.