If you are a software developer you know how hard it can be to test user sign-up on websites or mobile apps. Many applications rely on unique email addresses. Additionally, most user sign up processes rely on email verification. How do we test this in automated tests?
Creating email addresses in code
With MailSlurp (a free email API) you can create real email accounts on demand in code or tests. Then you can send and receive emails to imitate user sign up.
Install MailSlurp
Get an API Key (it's free)
Create an account at app.mailslurp.com. Next copy the and use it to initialize a MailSlurp Javascript client.
Create test email accounts
You can create email addresses for testing user sign-up easily with the asynchronous command. This returns an inbox that has an addresses and an ID.
The resulting inbox will look something like this:
Sign up the user
Once you have created a new email address use that to sign-up a user in your tests. We recommend using a browser testing suite like JestPuppetteer or CypressJS or WDIO for this.
Complete email verification
If you sign-up process send a confirmation email to the user then you can use your MailSlurp inbox to receive the email in your tests.
That's it
MailSlurp is a free email API for testing email related processes like user sign-up and email password reset. Check out the documentation for more.