I'm testing an Email system where I would test a set of received emails to see if the received emails actually displayed as expected.

This is done for each release of the system. So basically I want to automate this process. When the emails are received, the automated testing process should open each email through the web browser (because emails are typically sent to Gmail account) and validate them.

Also in the manual testing process, each email is identified by a string in the email content.

  • 2
    Hi, Sinaru, when you say "displayed as expected" do you mean that they contain all the text you expect, or that they contain the text and markup you're expecting? If you're wanting to validate text, that's fairly easy. Validating layout, markup and display is something that's often better handled manually. – Kate Paulk Aug 15 '13 at 11:35
  • 1
    If you just want to know whether the email arrives in your Inbox or gets stuck in your Spam folder, there is a simpler way to do that. – user246 Aug 15 '13 at 12:47
  • When you say, you are testing an Email system, are you testing the sending part of the system (MTA) or are you using a service and want to test that it sends your emails correctly? – Suchit Parikh Aug 15 '13 at 16:38

Since everything is web based, can't you just use a strait up browser automation framework like Selenium?

  • Do what you need to do in your system to trigger the sending of the email.
  • Log into Gmail
  • Check if the email is there
  • Take a screenshot (if needed)

Anything you can do as a user (besides thinking and seeing if visual layout is nice) you can more or less do in some flavor of Selenium.


My bad I misread the question. You can just fire up a selenium browser in a process that sits in gmail in HTML Only mode, checks for new messages every X seconds (by pulling for the elments), and then opens the emails and runs whatever test you want to do on the email.

  • Gmail in html mode is easy mode for automating email-related tasks. You can record a sample test in selenium and edit it to meet your needs; might be up and running in as little as a few hours. – Lucas Schwarz Aug 26 '13 at 22:43

Disclaimer - I work for the company that made a solution for this scenario.

mailosaur.com gives you unlimited test email addresses and a fake SMTP server. Each time an email is received, it will parse the html and extract all the links, optionally visit all these links and store the responses etc...

There's a REST API which allows you to access any property of your email for validaton. We have bindings for Java, .NET and Ruby to make your life as easy as possible.


I'm not sure what using Gmail will do to repeatably. If the Emails have the same structure with small differences (e.g. the date or version number) why not compare the text or binary parts to a golden copy of the Email ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.