0

So basically i am trying to automate the testing flow for the email functionality wherein - emails are triggered from application to users when they fill in a specific form and provide there email id as part of it. eg - username@mail.com fills the form and an auto generated email is received on username@mail.com

Use case -

  1. Need to verify if relevant email is received by the user in there inbox since there are a bunch of email templates.

  2. The user can also reply to the email received in point 1 and then i need to validate if the reply is appearing on a web page on the app.

Is there a way this can be done via UI automation

5
  • whats the tricky part , you knnow your applicaiton better than anyone else here . Could you add more details
    – PDHide
    Jan 25 at 19:56
  • 1
    Why do you have the Selenium tag? (1) (2) can probably be covered with unit tests of the objects that generate and send emails, no need to involve a GUI with the description you mentioned. Jan 25 at 22:14
  • Is this an automation thing? Seems like the proper email being sent would be in the unit test. Are you able to return a value to the UI that selenium could capture? Like in the http response "sent template alpha" or something?
    – corsiKa
    Jan 26 at 7:49
  • @corsiKa - Yes it is . Just to elaborate it a bit more, the emails are already been triggered by the application . I just need to automate the testing flow. a. Fill up the form with user email id b. once the email is sent, navigate to inbox of the stated user, c. Add assertions for latest email d. reply to that email e. Navigate back to application ,check the reply on the UI.
    – Praful
    Jan 26 at 8:31
  • Does each of your email template have a unique identifier in the UI? Feb 24 at 9:15
1

If you really, really need to do this via UI testing, a feasible way might be to test with a Gmail account.

Once you've sent your mail, use the Gmail API to poll for the new e-mail, read it, send a reply, then check back in your application for the response.

This entails you'll need some library to work on API-level.

0

You want to setup a java smtp server, that can handle incoming traffic. If you do not know what smtp server is:

An SMTP (Simple Mail Transfer Protocol) server is an application that’s primary purpose is to send, receive, and/or relay outgoing mail between email senders and receivers.

I did something quite similar a while back and used a java library called 'SubethaSMTP' and their simple smtp client called 'Wiser'.

Regarding your questions:

  1. You will be able to receive and 'read' incoming emails in your smtp client.
  2. You will be able to compose and send emails via the smtp client.

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.