✉️ Automated Email Testing

Automated emails are a common component in many web applications. Since they serve an important role in many critical user-flows such as registration, authentication, and system notifications, they should be tested carefully for any breaking changes.

Using Loadmill's ephemeral inbox and dedicated email API, you can include email workflows in your automated tests.

Key Concepts

The Loadmill ephemeral inbox receives emails at ${domain}+${UUID}@test.loadmill.com where ${domain} is your Loadmill team's email domain and ${UUID} is a random UUID generated by the built-in __random_uuid() functions in your Loadmill tests.

The Loadmill open email API is available at this URL:https://www.loadmill.com/open-api/emails/${UUID}. Use it to review the latest email sent to that UUID. The API will respond with the content of the last email sent to that address and can be used to extract and validate it.

User Registration Flow Example

Create a dynamic UUID parameter in the parameters section. Set its value to be the built-in __random_uuid function:

Use the UUID parameter to construct a dynamic email address and use it as the user registration email address:

In the following request, use the open email API and the UUID parameter to retrieve the signup verification email:

The last email sent to a specific UUID address will be available in text/html format and stored for 24-48 hours. (example)

Use the jQuery extractor to extract values from the email content. This extractor example will extract the link from the "Verify Address" button:

Note: when using the extracted ${link}parameter as the base URL for the following request, give it a default value in the parameters section, in case that no valid URL will be extracted from the email.

Suggested workflow