Email Testing Examples

In your typical test flow where you need to test emails, you would either need to send an email from your Test Case or receive an email triggered by some action in your testing, or both. The following sections describe how to test these actions in Provar.

Sending an Email

To send an email in a Test Case, navigate to the ‘Messaging’ section of the Test APIs Palette and drag and drop the ‘Send Message’ API into your Test Case.

Alternatively, you can drag the email browser into your Test Case and choose ‘Send a mail from this account’.

Populate the parameters as follows:

  • Source Connection: The Email Connection from which you wish to send the email
  • To, CC and BCC: The direct recipients, CC’s and BCC’s you wish to include in your email
  • Contents: The email body
  • Subject: The email subject line
  • Signature: The email signature

You can also add an attachment by clicking the Parameter icon above (see circled) and populating the attachment path.

Then save the Test Case.

Receiving an Email / Subscribing to an Email Connection

To receive an email in a Test Case, navigate to the ‘Messaging’ section of the Test APIs Palette and drag and drop the ‘Subscribe’ API into your Test Case.

Alternatively, you can also drag the email browser into your Test Case and select ‘Subscribe to this mail folder’.

Populate the parameters as follows:

  • Source Connection: The Email Connection you wish to receive email from / subscribe to
  • Folder, From, Subject: Any filters to be applied to the emails being read. Leave these blank if you wish to read all emails
  • Subscription Name: The variable that will contain the results of the email(s) read and the subscription scope

Then save the Test Case.

Note: make sure that this Subscribe Test Step is executed in your Test Case before the email is triggered in the execution flow.

Receiving an email after polling

Use the Wait For API to receive an email after a defined period of time. This API will poll the email account until a given condition is satisfied or the defined wait time has elapsed.

To use the Wait For API, navigate to the ‘Control’ section of the Test APIs Palette and drag and drop the ‘Wait For’ API into your Test Case.

Populate the standard Wait For API parameters.

When populating Condition, note that you can enter a period after the Result variable to access variables such as messageCount (see screenshot above).

Then save the Test Case.

2017-05-12T11:35:05+00:00

Leave A Comment