Product
Docs
Resources
Log In

Sign Up

6 'Must-Have' Test Cases for Email Notification

In business, retaining existing customers is always easier than finding new ones. With competition threatening to steer potential clients away from your brand, ensuring email notifications work as intended is important. Email serves as an excellent medium to communicate with your customers and provides an effective way to keep thousands of people engaged effortlessly.

This guide was created to showcase six email notification test cases that should be available in any smoke or regression test suite. Since you need to validate users by getting these email notifications directly into their inboxes, your test plan should confirm all of the following:

  1. Time-sensitive emails arrive on time
  2. Reminder emails arrive regularly and on time
  3. Overdue reminders carry the correct information and limit send frequency
  4. Subscription emails carry an unsubscribe link
  5. Emails carrying forms submit only once
  6. Confirmation emails arrive after a customer order with the correct details

These test cases entail common email types that either require your customers' immediate attention or have them interact with key product features. In addition, they can help developers create tests to pinpoint edge cases when parameterized with minimum or maximum values (i.e., no recipient or extremely long email addresses).

1. Time-Sensitive Emails Arrive on Time

When confirming a new account or resetting passwords, it's especially important that emails reach their intended recipient in a timely manner. However, if your email delivery system delays sending messages out minutes—or worse still, hours—after users interact with your product, you risk losing loyal customers.

Getting that timing right is increasingly crucial in a competitive market, especially since a big advantage of time-sensitive emails is the fact recipients are most receptive to their content.

In addition to deploying emails at the right time, it's equally important that attached links work as intended. If customers get a password reset email but aren't able to actually reset their password due to technical issues, what good is the email?

In order to mitigate risk, it's important that developers validate the email date and the attached links to ensure they hit their intended page.

For example, you can forward emails to Endtest Mailbox and verify key HTML elements with Selenium. In this sample scenario, you'll focus on verifying the "Confirm your email" button functionality, as well as the email date/time and title.

The first step is to locate the confirmation email:

1 2 3 4 5 driver.get("https://app.endtest.io/mailbox?email=jsunderland@endtest-mail.io") print(driver.title) emailTitle = driver.find_element(By.XPATH, '/html[1]/body[1]/div[1]/div[2]/div[1]/div[2]') print(emailTitle.text)

Email Notification Alert

After locating it, open up the email and validate two points—the date attached and a "Confirm your email" button:

1 2 3 4 5 6 7 8 9 10 emailTitle.click() time.sleep(10) confirmDate = driver.find_element(By.XPATH, '/html[1]/body[1]/div[1]/div[2]/div[1]/div[3]') print(confirmDate.text) confirmEmail = driver.find_element(By.XPATH, "/html[1]/body[1]/div[1]/div[2]/div[1]/div[4]/div[1]/div[1]/" "div[1]/div[2]/table[1]/tbody[1]/tr[1]/td[1]/" "table[1]/tbody[1]/tr[2]/td[1]/p[2]/a[1]") print(confirmEmail.text)

Time Sensitive Email Notification

When you click the "Confirm your email" button, a new window should open, and you will be redirected to a registration confirmation page:

1 2 3 4 5 6 confirmEmail.click() time.sleep(10) window_after = driver.window_handles[1] driver.switch_to.window(window_after) print(driver.title)

Registration Confirmation Email Notification

After running the test, the output is as follows:

Email Confirmation Test

2. Reminder Emails Arrive Regularly and On Time

Whether it's the end of a free trial, promoting an ongoing sale, or encouraging event registration, businesses often convey prevalent information via reminder emails. When it comes to email marketing tactics, reminder emails play an important role in client retention and help companies achieve their sales goals.

For example, many apps rely on monthly subscriptions as their primary source of income. However, if the email delivery system fails to send existing customers a reminder to renew their membership, it's unlikely they will. Interestingly enough, a major reason clients don't renew their subscriptions is that companies never ask them.

While people are busy with their daily lives, reminders are very beneficial for engaging recipients and furthering the goals of the companies that send them. Needless to say, it's important for developers to verify that these reminder emails arrive regularly and on time.

3. Overdue Reminders Carry the Correct Information and Limit Send Frequency

When it comes to debt collection, time is essential. The collectability of accounts is 90 percent in the first 60 days. Soon after, it plunges down to 50 percent after 90 days—and finally, only 20 percent after 180 days overdue. In order to mitigate financial loss, developers should make validating overdue reminder emails a top priority in test suites.

When drafting test case steps, it's important to focus on verifying the number of overdue days and the frequency of emails sent on a weekly or monthly basis.

Oracle provides the Date-Time package that developers can use to establish payment due dates, indicate the number of days the client hasn't paid their invoice, and specify the desired time zone. For example, if you sent an invoice with the due date of June 9, 2023, and the client was thirty days late, your code could be written as:

1 2 3 4 5 LocalDate invoiceDate = LocalDate.of(2023, Month.JUNE, 9); LocalDate dueDate = invoiceDate.plusDays(30); if (dueDate.isBefore(LocalDate.now(ZoneId.of("America/Phoenix")))) { System.out.println("Overdue; was due on " + dueDate); }

When running the code, the output is as follows:

1 Overdue; was due on 2023-06-09

While it's important that overdue reminder emails are sent frequently, it's equally important that you limit the amount sent to avoid annoying your customers. This is easily accomplished with the Timer class. For example, it's recommended that you limit sending past-due emails to every thirty, sixty, and ninety days. In that case, you can insert a Timer class and call a method to deliver your overdue email at a specific time (e.g., every thirty days).

Subscription emails are an important driver of traffic and allow business owners to effectively communicate and build meaningful relationships with customers. However, people unsubscribe for a multitude of reasons: email frequency, too much content, or the reader simply moving on.

No one likes to lose customers. But the truth is, if your subscription emails don't have a working unsubscribe link, you're bound to irritate your user base. As a matter of fact, refusal to add an unsubscribe link may even be against the law.

It isn't all doom and gloom, though. Email marketing campaigns can calculate subscribe vs. unsubscribe ratios to keep a tab on whether or not their email content is relevant. If businesses note a sharp drop in subscription rates, they can always implement steps to improve things in the future.

Of course, it's important for developers to unit-test unsubscribe URLs on emails to validate their functionality.

Thankfully, Courier makes the process easy to do with their Preferences API. With Courier, simply add a new link and set the hyperlink URL to {$.urls.unsubscribe}. When clicked, the notification is disabled for the recipient and presents them with a basic "You have been unsubscribed from this notification." message.

5. Emails Carrying Forms Submit Only Once

Clickable links that redirect users to HTML forms via emails are particularly useful if you're looking for user feedback. According to GetFeedback, embedded feedback emails increase user engagement by up to 210 percent compared to traditional feedback emails.

With that in mind, it's important for developers to validate that URL links in emails redirect to the correct form submission page. Furthermore, if the user fills out a form and clicks the URL again, they should receive a notice that their form was already submitted.

When testing email forms, a go-to solution is simply disabling the button on submit using basic JavaScript and making the form properties idempotent to prevent duplicate submissions. On Stack Overflow, a developer kept getting duplicate entries on their database after impatient users kept clicking the submit button multiple times. This problem was soon rectified after a two-fold solution was advised.

First was disabling the button after users submitted their form:

1 2 3 $('form').submit(function(){ $('input[type=submit]', this).attr('disabled', 'disabled'); });

And while this acts as a basic first line of defense in many test cases, you could go a step further by making the operation idempotent. In other words, if a user submits a form, put a unique ID on it. The first time a form submits, it should respond with "success". Subsequent submissions will offer the user a "success" message, but won't change anything in the backend.

6. Confirmation Emails Arrive After a Customer Order with the Correct Details

Imagine you book an airline ticket for a vacation you've planned months in advance. However, when you check your inbox, there's no proof you've booked a flight at all. You begin to panic: was your flight booked successfully? Did you use the wrong email address?

This lack of confirmation email would probably leave you frustrated and perhaps unlikely to book a flight with that airline again.

In fact, confirmation emails are so important that 49 percent of residents in Saudi Arabia state that lack of order confirmation is the biggest uncertainty around widespread online food order adoption.

Developers validating confirmation emails need to verify the unique booking or order number to ensure no other orders carry the same ID. They should also verify customer details , such as user information, billing address, shipping address, and price.

In this basic example, developers can validate the email title, confirmation ID, and email sender:

Confirmation Email Notification

Do These Test Cases Validate Your Email Notifications?

Whether you're sending thousands of subscribers emails daily or a single past-due reminder, it's important your email delivery system works as intended. The email types discussed in this article are incredibly common, sent regularly to your customers. If even minor bugs bypass these basic email types, business owners risk significant losses in revenue and clients.

If you're looking for easier yet effective ways to optimize your email notification delivery system, check out Courier. With Courier, you can manage all product communication mediums (i.e., email, chat, SMS, etc.) all in one API. It allows developers to easily change between email delivery service providers and makes handling email notifications effortless.

Ready to build a powerful email notification delivery system you're proud of? Get started with Courier today.

View More Guides

Build your first notification in minutes

Send up to 10,000 notifications every month, for free.

Get started for free

Email & push notification

Build your first notification in minutes

Send up to 10,000 notifications every month, for free.

Get started for free

Email & push notification

Product

Pricing

Providers

Developers

Documentation

API

Libraries

Status

© 2023 Courier. All rights reserved.