Email QA Automation

Run Email test scenarios using the Crank BDD framework.

An Inbox (Mailgun) Logo

Who cares if your email is pixel-perfect when the program that sends it is misfiring? Automatically QA your welcome, confirmation, nurture, and drip campaigns.

Email Onboarding Program QA

Make sure your onboarding program gets kicked off immediately.

- step: ...And I enter {{some.email}} into input[name=Email]
- step: When I submit the form by clicking button[value=Start Trial]
- step: Then there should be 1 email in mailgun for {{some.email}}
Email Personalization QA

Make sure your template tokens get replaced correctly.

- step: When I enroll the {{test}} Hubspot contact into workflow Welcome Email Send
- step: Then the subject of the 1st mailgun email for {{test}} should be Welcome, Test Name

What is Crank?

Crank is a BDD test automation framework for SaaS-based business technology.

Developer Getting StartedHosted QA Automation for Business Users

Installing and Authenticating this Cog

Once you've successfully installed Crank you can install this Cog by running the following:

$ crank cog:install automatoninc/inbox-mailgun

You will be asked for the following authentication details on installation. To avoid prompts in a CI/CD context, you can provide the same details as environment variables.

Expected Authentication Details
FieldInstall-Time Environment VariableDescription
apiKey *CRANK_AUTOMATONINC_INBOX_MAILGUN__APIKEYMailgun API Key
domain *CRANK_AUTOMATONINC_INBOX_MAILGUN__DOMAINEmail Domain
endpoint *CRANK_AUTOMATONINC_INBOX_MAILGUN__ENDPOINTMailgun API Endpoint

You can always re-authenticate by running the following command.

$ crank cog:auth automatoninc/inbox-mailgun

Email Test Steps

Check that no link in an email is broken Assertion

Use this step in a Scenario file like this:

- step: Then the {{position}} mailgun email for {{email}} should not contain broken links
Expected Step Input
IDTypeDescription
email *Email AddressThe inbox's email address
position *NumberThe nth message to check from the email's inbox
Exposed Dynamic Tokens
TokenTypeDescription
{{inbox-mailgun.messages.0.#}}NumberEmail receipt order number
{{inbox-mailgun.messages.0.Subject}}StringEmail subject line
{{inbox-mailgun.messages.0.From}}StringEmail from line
{{inbox-mailgun.messages.0.To}}StringEmail to line
{{inbox-mailgun.links.0.Type}}StringLink Found In (e.g. HTML or Plain-Text)
{{inbox-mailgun.links.0.Url}}URLLink URL
{{inbox-mailgun.links.0.StatusCode}}NumberHTTP Status code when the link was checked (e.g. 404 or 200)

Check the content of an email Assertion

Use this step in a Scenario file like this:

- step: Then the {{field}}) of the {{position}} mailgun email for {{email}} {{operator}}) {{expectation}}
Expected Step Input
IDTypeDescription
email *Email AddressThe inbox's email address
position *NumberThe nth message to check from the email's inbox
field *StringField name to check
operator *StringThe operator to use when performing the validation. Current supported values are: should contain, should not contain, and should be
expectation *Any ScalarExpected field value

Check the number of emails received Assertion

Use this step in a Scenario file like this:

- step: Then there should be {{count}} emails in mailgun for {{email}}
Expected Step Input
IDTypeDescription
email *Email AddressThe inbox's email address
count *NumberThe number received
Exposed Dynamic Tokens
TokenTypeDescription
{{inbox-mailgun.messages.0.#}}NumberEmail receipt order number
{{inbox-mailgun.messages.0.Subject}}StringEmail subject line
{{inbox-mailgun.messages.0.From}}StringEmail from line
{{inbox-mailgun.messages.0.To}}StringEmail to line

Missing a Step You Need?

This Cog is open source! Your contributions are welcome and encouraged.

Contribute on GitHubJoin the Crank Spectrum Community