Image for post
Image for post

Background

Email is a key component of most modern applications. It identifies users, let’s them sign-up and login, reset passwords and confirm their accounts. Email is important but, strangely, testing processes that rely on email end-to-end can be difficult.


Image for post
Image for post
Email APIs let you create email addresses on demand during automated tests.

Why?

Many applications rely on email addresses in some way: for user sign-up, account verification, notifications, communication and more. In order to truly test these features end-to-end one needs access to real email addresses in code. That is what MailSlurp enables: real private inboxes that can send and receive email in applications and tests.

Basics

In testing it is best to create all the entities you need each test run. This ensures that you start with a blank slate each time.

Environments

MailSlurp has a REST API and SDKs in Javascript, PHP, Java, Python, Go and more so it integrates into most test platforms. …


Selenium is an integration test framework with C# bindings. We can use it with test email accounts to send and receive emails from code and tests.

Image for post
Image for post

If you write .NET applications you probably deal with email addresses at some point: for user sign-up, email newsletters, password resets and more. If you want to test this functionality end-to-end you need test email accounts.

MailSlurp is a free API that lets you create email addresses in C# then send and receive emails with them. This article will show you how to test a web applications user sign-up using Nunit, .NET Core 2.1, Selenium and Firefox Gecko Driver.

Example application

For an example of using emails in selenium with .NET we will use a dummy web app hosted at https://playground.mailslurp.com.


How to send and receive emails in Cypress integration tests using Javascript and the free MailSlurp library.

What is Cypress Js?

Cypress is an amazing end-to-end testing framework. It’s popular, bundles its own chrome browser and is easily extended. Here is a screenshot:

Image for post
Image for post
An example login form being tested with Cypress.

Cypress lets you test many parts of a website or web application with a browser in an automated way. It’s like Selenium but a lot more user-friendly.

Testing with real email addresses

Many application use emails for account login and creation. Testing logins with Cypress is easy if you have a designated test user — but what about sign ups?

Email sign up has to be the most important aspect of any application and without access to unique, private email addresses end-to-end testing is difficult. …


Image for post
Image for post
Create embeddable HTML forms that submit directly to your email address.

With MailSlurp you can receive form submissions directly to your email address — no server or Javascript required. Plus it’s free :)

Why? (it’s simple and free)

These days HTML and the Jamstack can achieve a lot. But how do you process form submissions without a server? Well with MailSlurp you can get form submissions sent directly to your email address — file attachments included!

1. Create an HTML form

Simply create an HTML form with method="post" and action"=https://api.mailslurp.com/forms?_to=YOUR_EMAIL_ADDRESS" . When the form is submitted all the named inputs will be collected by MailSlurp and sent to the email address provided.

<form 
action="https://api.mailslurp.com/forms?_to=YOUR_EMAIL_ADDRESS"
method="post">
<!-- inputs will go here -->
</form>

2. Add inputs you wish to receive

<form 
action="https://api.mailslurp.com/forms?_to=YOUR_EMAIL_ADDRESS"
method="post">
<!-- add any input field -->
<input name="birthday" placeholder="Please enter your birthday">
<button type="submit">Submit</button>
</form>

3. Receive submissions to your email address

That’s it! Now try submitting the form. MailSlurp will read the form values and send them to the email address specified. …


How to send and receive email in applications and tests using on-demand email accounts.

REST API and SDKs

MailSlurp is an email API service for creating email addresses on demand from which you can send and receive email in code or online. It has a simple HTTP API plus official libraries in Javascript, Python, PHP, Java, Golang, Ruby, Objective C, and C# / DotNet.

Email addresses on demand

Create new private email addresses on demand from applications or tests. (Examples in Javascript but available in all languages.)

// create a randomly assigned email address
const inbox = await mailslurp.createInbox()
console.log(inbox.emailAddress)

// create a custom email address with your own domain
const customInbox = await mailslurp.createInbox('user@mydomain.com')

Fetch emails in code

Receive emails directly in tests or applications.

// hold connection open until first email found or timeout
const email = await mailslurp.waitForLatestEmail(inbox.id)
console.log(email.subject, email.body, email.attachments)

// more examples
const nthEmail = await mailslurp.waitForNthEmail(inbox.id, index)
const emails = await mailslurp.waitForEmailCountinbox(inbox.id, …

Quickly graph and visualize your data with an open-source data platform.

Image for post
Image for post
Redash is an open-source data visualization tool that is easily deployed to with Terraform and AWS.

What is Redash?

Redash is an open-source data visualization tool used by companies as diverse as Soundcloud, Mozilla, and Waze. It allows developers and analyts to query data, graph results, and share insights with others. The best thing about Redash is that it is completely free to self-host (minus your own infrastructure costs).

Why deploy self-hosted Redash?

Redash.io offers a super simple one-click start for hmanaged Redash instances. These are great for companies that want data insights fast but for companies with smaller budgets or developers who want extra control over data and security self-hosting Redash is a valuable endeavour.

How does Redash work?

Redash is not a trivial application (hence the hosted solutions). It has several databases, worker threads, and a web interface. Setting all that up could be difficult. Fortunately, Redash.io provides a set of prebuilt and self-contained images for a number of platforms including AWS. …


How to create email addresses dynamically in code to test your app’s user sign-up, email confirmation, and password reset properly.

Image for post
Image for post
How do you test email confirmation steps E2E?

Background

Email is a key component of most modern applications. It identifies users, let’s them sign-up and login, reset passwords and confirm their accounts. Email is important but, strangely, testing processes that rely on email end-to-end can be difficult.

Email testing APIs


Use test email accounts with Cucumber and MailSlurp to fully test user sign-up, email confirmation, and more.

Image for post
Image for post
Send and Receive emails in applications and tests with MailSlurp

Cucumber meet MailSlurp

Cucumber is an extremely popular behaviour driven test framework used by developers around the world. It started as a Ruby project but now supports many languages and use cases.


End-to-end testing with real email addresses. Unlimited test email accounts for applications or tests. Free for personal use!

Edit: since originally publish we made a new guide with detailed examples!

About

Cypress is an amazing end-to-end testing framework. It’s popular, bundles it’s own chrome browser and is easily extended.

Image for post
Image for post

Cypress let’s you test many parts of a website or web application with a browser in an automated way. It’s like Selenium but a lot more user friendly.

Testing with real email addresses

Many application use emails for account login and creation. Testing logins with Cypress is easy if you have a designated test user. But what about sign ups?

Email sign up has to be the most important aspect of any application and without access to unique, private email addresses end-to-end testing is difficult. …

About

MailSlurp | Email APIs for developers

Test Email API for end-to-end with real email addresses. Support for NodeJS, PHP, Python, Ruby, Java, C# and more. See https://www.mailslurp.com for details.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store