I have to test if users receive email correctly depending upon the following scenario.

  1. If user selects 3 mail per day : Should receive mails 3 mails in a day after every 8 hours.
  2. Daily : user should receive mails daily
  3. Weekly : User should receive weekly mail.

Can this scenario be automated? If so, how?


Exactly how this will work depends on your application setup, but in general you have several options:

  • If you have access to the mail server which sends the emails, you can manually or with automation (depending on the server interface) check that emails were sent as expected.
  • If your application logs what emails were sent to whom and when, you can use those logs (manually or with automation) to check that emails were sent as expected.

Regardless of the configuration of your application, you're going to need to do some setup to make this happen. Whether you automate the setup or not is up to you.

  • Create three email accounts. For convenience, use a free webmail provider like gmail, yahoo mail, etc. I'd name them: ThreePerDay@... Daily@... Weekly@... You might need to add some extra to the username to get a unique one.
  • Each email account signs up for the appropriate mail option.
  • Wait 8 days. You know when the emails should arrive, and you know what email address they should come from, so you can use that to filter.
  • Check each email account. Depending on the exact email scheduling and when you check, you should see the correct number of emails from your application in each account's inbox.

This can be automated, but I honestly wouldn't recommend it: once you've set it up, you can store the credentials for the accounts in a password manager on-site, and something like this is generally a set-and-forget thing: the code that does the email and the code that does the bundling won't be changed all that often.

Setting up the email accounts will take maybe 15 minutes manually, and won't need to be repeated. Depending on how complex your system is, the signing up for email will also be a fairly short, simple process - at most 30 minutes to get all three users signed up, manually, with no need to repeat the signup. Checking the emails is at most 30 minutes all told.

It's going to take multiple hours to build the automation that will reduce the time for each check of the email accounts to perhaps 5 minutes: you would need to run this daily for years to recover the time you put into it - which seems counterproductive to me, given that this is the kind of feature that doesn't get changed much.

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.