Case Study: User Reset Password via Email in Selenium WebDriver

A typical user reset password test scenario by email.

Zhimin Zhan
6 min readSep 4, 2022

--

A repost of my daughter’s article with permission. I added a few notes. This is also included in my “How to in Selenium WebDriver” series.

Checking emails in automated tests is quite common. Typical cases are user-sign-up (confirm email address) and user-reset password (get password reset link). In a previous article, I went through how to use MailCatcher or a temporary online mail service to complete the user sign up test case. This article will cover the user-reset password test case by clicking the reset link in the reset email.

The sample site I will use is WhenWise (https://whenwise.agileway.net/).

Table of Contents:
· With MailCatcher
· TempMailo
Complete test script
· Zhimin’s notes

Using a newly registered user for this test case. If using an existing user, changing its password might affect other testing activities.

If do use an existing user, learn more on how to clean up after reset password tests in this article.

  1. Register a new user by email
    a random email address.
  2. Enter your email on the ‘Reset Password’ page then click the “Reset” button
  3. Wait for the reset password email and visit the reset link in it
  4. Enter the new password
  5. Login with email and new password successfully

There are two “gotchas” for this test case:

  1. Register a brand new user just for this test case only
    Essentially, include the ‘User Sign up’ test steps first. Because other team members are not aware of this new user, we don’t need to worry about the effect of password change.
  2. Receiving and reading emails
    This is covered in the previous article, but we can use a fake SMTP server or a temporary online mail service to receive emails.

With MailCatcher

--

--

Zhimin Zhan

Test automation & CT coach, author, speaker and award-winning software developer. Help teams succeed with Agile/DevOps by implementing real Continuous Testing.