How to Create a JMeter Script to Check Email During Registration AND Grab the Confirmation URL

Today, we'll review how to create a script sample which will allow you to check e-mail during the registration process and grab confirmation URL from the e-mail.  

 Generally, registration is a core functionality that doesn't allow for bad performance, because we can get security holes, lost data and other “pleasant” things. That’s why registration should be tested in the first turn of the performance QA cycle. And e-mail verification is a standard part of this functionality. 

We'll use Mantis BT, WAMP server and the Apache James mail-server. All this stuff, installed locally on my PC,  allows me to NOT trigger public e-mail services (e.g. Google, Yahoo, etc.), but rather, get a pure isolated environment.

The Steps:
- Install WAMP server;
- Install and configure Mantis BT;
- Install Apache James mail server;
- Set up a user account at the mail server.
Once you complete the above steps, let's move onto the script.

Here is general screenshot of future script.

First, I fill in the HTTP Request Defaults.

Next element is User Defined Variables

And now – the Mail Reader Sampler

With the help of this element you can login to mail server (Apache James, installed locally in our case), and read content of any folder.
What should we specify?
- mail protocol = pop3 (in our case);
- server host = localhost.localdomain;
- server port = 110;
- username = ${username}@localhost.localdomain, where ${username} will be taken from User Defined Variables;
- password = ${password}, where ${password} will be taken from User Defined Variables;
- folder = INBOX;
After we get a message/response from the server, we need to extract the confirmation  URL from it.

P.S. That’s why we added the Regular Expression Extractor as the child element for Get e-mail from James Server. 

Note on the following two screenshots that the Regular Expression Extractor successfully grabbed the confirmation URL from the e-mail message.

As you can see, this approach can be used during performance testing of local machines.
When testing from the cloud, like say The fabulous BlazeMeter load testing cloud...ahem, ahem...we only need make a slight change. Simply replace the e-mail server credentials from local to any public e-mail service (e.g. Google, Yahoo, etc.) where we have an account.

  So, we don't need to change the structure of this script before uploading it to the cloud.

Have more questions? Submit a request


Please sign in to leave a comment.