BDD Testing of HTML Email with links

Scenario: An email is sent and we want to check that the links on the email point to pages that contain appropriate content. This method avoids needing to a) setup an account for those emails, b) putting those credentials in our source repo, and c) testing that email itself works.

Editing Image:

BDD Testing of HTML Email with Links


The steps are listed in the notes with elaboration here:

    1. An email is generated in HTML. This email should have HTML so it is readable once it is brought into a browser that Selenium can work with. This file may be generated by the application under external trigger from the test or performed manually.
    2. The body of the email is saved out to a test directory where the Gherkin tests can find them. This document doesn’t cover a naming convention for the emails or the bodies of the email themselves. This is a Manual Step which can be scripted or built into the test script.
    3. The Test code is able to read from the File URL to bring the Email into a browser. At this point, the content of the email should be avaialble to the Selenium API for checking the content of the email.
    4. Each link within the Email could lead to a page whose content should be appropriate for the email and its link. This is the value of the regression test, covering not only the URL within the email, but also the content of the page that is retrieved once that link is followed.

Leave a Reply

Your email address will not be published. Required fields are marked *