When testing the various steps of account sign-up, creation and activation processess, one must be mindful of designs which call for unique email addresses to be confirmed for each new account. While this is a generally accepted approach, it does pose a slight challenge when end-to-end testing requires email activation from the address with which the account was created.
Creating multiple Accounts under the same Email Address
Recently, while implementing an account registration feature, I was looking for a simple means of creating and testing multiple user accounts against a single email address, so as to allow for continuous testing without the need to use different email addresses for each test.
Fortunately, a few clever solutions have been available all along in Gmail which can be leveraged for this very problem (in addition to others).
The Plus (+) Trick
Perhaps the simplest means of creating or generating unique email addresses for account creation which will all be sent to the same email address is to leverage the Plus (+) Trick.
For instance, suppose you are testing account creation and activation and want to confirm the sign-up process at someuser@gmail.com
. Typically, one would want to test this feature multiple times – either by means of automated testing, manual integration testing, or the like. In order to test the account creation feature continuously using the same someuser@gmail.com
account, one can simply create new accounts by appending a plus (+) to their gmail user name, and postfix a unique string of charachters to the plus sign:
1 2 3 4 5 6 | someuser+test1@gmail.com someuser+test2@gmail.com someuser+test3@gmail.com ... |
In this example, emails sent to any of the addresses above would all go to someuser@gmail.com
. With this in mind, it is quite easy to continuously test account creation processess without the need to use multiple (real) email addresses.
The Dot (.) Trick
As with the Plus (+) Trick, similarly, the Dot (.) Trick can also be employed to test account creation under the same email address.
For instance, to test an account creation and activation process feature continuously using the same someuser@gmail.com
account, one can simply create new accounts by inserting a dot “.” within their gmail user name:
1 2 3 4 5 6 | some.user@gmail.com s.omeuser@gmail.com som.euser@gmail.com ... |
In this example, emails sent to any of these addresses above would all be sent to someuser@gmail.com
.
Concluding Thoughts
As can be seen in the above examples, both the Plus (+) Trick and Dot (.) Trick, respectively, can be used to create and test account sign-up and activation processes against a single email address, greatly simplifying testing.
While the Dot (.) Trick is quite useful, it is obviously limited to a finite combination of pseudo-unique email addresses, and thus, it is better suited for fewer testing scenarios.
For more extensive testing scenarios, the Plus (+) Trick is much better suited, as it allows for seemingly infinite permutations of the same email address, and is ideal for generating addresses from which account creation is to be tested.