7

I'm helping to automate an new web application, part of this application requires email verification. What are the industry standards for automating the black hole known as "email"? What I'm trying to do is automate this piece of functionality without having any dependency on third party applications, like outlook or gmail.

  • Should these emails be stored in a database via the application and then retrieved?
  • Should we have an email sniffer that make the emails available via text file or again in db?

FYI, we are using the webAii automation framework.

5
  • 1
    what do you mean by 'verification' ? what exactly are you trying to test - that emails are sent out ? Oct 18, 2011 at 17:18
  • We are trying to automate a work flow, part of the work flow is emailing a user and clicking a link within the email. There is more to it but the "email" part of the test case is what has me stumped. How do I automate without depending / qaing a third party app.
    – Stefano D
    Oct 18, 2011 at 17:21
  • 1
    can you separate that part out ? Some part of your app is generating a link so automate that link click, putting the link into an email is another test ? Oct 18, 2011 at 17:54
  • I'm trying to automate the link click but I have no mechanism to retrieve the link other than email. So that is what I'm asking, how do others who automate UI's handle this sort of scenario? I could ask development or IT to create a mechanism that makes the link available to me but I don't know what the "right way" is.
    – Stefano D
    Oct 18, 2011 at 20:12
  • Do you have (or can you create) a Mock of the email library being used? Including send and receive functions? Then your workflow test just tests the workflow itself and doesn't need to worry itself about the details of the email messages. Oct 19, 2011 at 5:06

6 Answers 6

10

I have done a simple thing.

  1. Setup a IMAP/POP3 mail server
  2. Send the mail to server
  3. Retrieve the mail from the server using code. (Java Mail API for example)
  4. Do further actions.

I don't know about any industry standard. But this works for me.

1
  • This is pretty bang on. For any serious email testing you need to have your own server or simulator. In the past I have used one that dropped a file containing the email onto a file share with a known file name and accessed them from there. Mar 3, 2013 at 21:38
2

I've used Mailosaur in the past to do the exact same thing, and plan to use this again. I'm hoping that in a few days I will have this implemented in my automation framework. There are other services as well that provide it.

1

As best as I can tell, you have two problems: you want to verify that the email is sent but you don't want to depend on an existing email provider; and you want to test what happens when an email's embedded link is clicked.

For the first problem, I would probably configure a test mode in the server in which it would write files to the file system or to a database. In the past, I have accomplished the latter by implementing a custom provider in the Java Mail API.

For the second problem, I would parse the email to extract the verification URL. (I assume you know how to simulate the click once you have the URL.)

Of course, this approach will not check whether the email is legible or understandable or whether the email layout is correct in Outlook or in any of the popular email readers like Gmail or Yahoo Mail, but you can always do that by hand.

1

Are you trying to test the actual email verification process itself, or is the verification just a necessary step to enable further testing of other features?

If the latter, you might consider it cheaper to provide a test-specific(*) method to simply set an email address as 'verified' and leave the testing of email verification itself to your manual testing. Especially considering you're likely to want to do email verification by hand anyway to check it actually delivers to 3rd party inboxes and looks right (to a human).

(*) Make sure you don't leave this method enabled in a production build unless suitably protected!

1

Disclaimer - I work for the company that made this.

You might find that a hosted service such as Mailosaur is helpful for this.

You can of course set up something like this yourself , but the benefit of someone else doing the hard work is obvious.

0

Use an inbound mail API service

For example, PostmarkApp have a clean inbound API and a generous free tier with usage based pricing (as of June 2016). I use them explicitly for testing transactional emails on my app. Trigger the action, then verify that the email has been received by postmark. The emails are sent via a different providers, but you could also send them with Postmark.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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