Receive and verify Emails

For many systems in order to activate a user, we need to follow an activation link received by email. Or you want to verify some notification email that should be triggered by your test input. We provide a simple Pop3 handler, that integrates with TestResults.io and lets you do just that.

The idea is that you register a single outlook.com (or gmx.net, gmail.com) account, such as myaccount@outlook.com. You then need to configure Pop3 on your mail account, so that the automated testcase can poll for new messages. Then you can use many different email addresses for your test cases, like myaccount+testcase1@outlook.com, myaccount+newUser@outlook.com, etc that all send to the same mailbox, but can be queried independently.

Please check our reference implementation to see how you can for example get an activation link from an email: https://github.com/TestResultsIO/DemoAutoScout24/tree/main/TC005_Rev1

In order to set this up, you will need to follow these steps:

  1. Setup email account, configure Pop3 (as described above)

  2. Add the nuget package Progile.TRIO.EmailHelper to your project

  3. Add a class like ReceiveEmails from demo to your project

  4. Configure your EmailUserName, EmailProvider and Password in the ReceiveEmails class

  5. If required, set the expected SenderAddress, that will send the emails you are expecting to receive.

  6. If required, adjust the implementation to parse the email in the GetActivationLinkFromEmail method

  7. Call ReceiveEmails.GetActivationLinkFromEmail(t); from your testcase (you might want to add the optional emailTag and subject parameters).

Last updated