Integrate Email Testing Service: Inbucket from Development to integration testing

LyLuongThien 17 views 18 slides Jun 26, 2024
Slide 1
Slide 1 of 18
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18

About This Presentation

Discover seamlessly integrating Inbucket, an open-source email testing application, into your in-house email service. This presentation will guide you through the entire process, from initial development setup to comprehensive integration testing. Learn how Inbucket can enhance your development work...


Slide Content

Integrate Email Testing Service: Inbucket from Development to integration testing Present by Thien Ly on June 26, 2024

Table of content * Intro to Inbucket - About Inbucket - Why Inbucket - Features - Pros and cons - Alternatives * Demo - Quick installation with docker - Integration testing and E2E implementation with puppeteer - Write a real-time email reader library for Inbucket * Q&A

Introduction to Inbucket

About inbucket “Inbucket is an email testing application ; it will accept messages for any email address and make them available to view via a web interface”. Inbucket is an email testing application designed for developers to test and debug outbound emails. Accepts messages for any email address and makes them viewable via a web interface. Acts as a disposable webmail and RESTful server. No database required, making setup and maintenance straightforward..

Why inbucket Secrecy: Keeps new applications secret until release. Integration Tests: Validates email sending in integration test suites. Security: Demonstrates email features without sharing personal email credentials. Isolation for testing: Load Testing: Avoids overloading corporate email servers during load tests. Data Safety: Uses production data in test environments without leaking test emails to end users. Preview Capability: Previews emails in multiple desktop email clients.

Features Protocols Supported : SMTP and POP3 with optional SSL. Installation Options : Binary installs for Linux, Docker. Main Website : inbucket.org GitHub Repository : github.com/inbucket/inbucket

Pros & Cons

Pros Speed up development: Easy setup and configuration. No database needed. Flexible and lightweight. Useful for both development and testing environments. Safety sensitive data for development

Cons Limited to email testing (not a full-featured email server). Basic web interface may not meet all needs.

Alternatives Mailinator: 3rd party email testing service. MailHog: Web and API based SMTP testing (only smtp protocol). StalwartLabs/MailServer: full feature mail server.

Demo

Demo: Installation Environment configuration : Access the web configurator at https://inbucket.org/configurator Example configuration: INBUCKET_STORAGE_TYPE : "file" INBUCKET_STORAGE_PARAMS : "path:/inbucket/storage" INBUCKET_SMTP_ADDR : "0.0.0.0:2500" INBUCKET_WEB_ADDR : "0.0.0.0:9000"

Demo: Installation Docker: Pull the Inbucket Docker image: docker pull inbucket/inbucket Run Inbucket: docker run -d -p 9000:9000 -p 2500:2500 -p 1100:1100 inbucket/inbucket Access the web interface at http://localhost:9000

Demo: Installation Docker Compose : [... others services config] inbucket : image : inbucket/inbucket ports: - 9000:9000 # Expose web interface for monitoring environment : INBUCKET_LOGLEVEL : "debug" INBUCKET_STORAGE_TYPE : "file" // use “memory” for testing INBUCKET_STORAGE_PARAMS : "path:/inbucket/storage" INBUCKET_SMTP_ADDR : "0.0.0.0:2500" INBUCKET_WEB_ADDR : "0.0.0.0:9000" volumes : - ./data/inbucket:/inbucket

Demo: Installation - Usage Use as normal SMTP service in development application: An example with nodemailer package, and then check the result on web interface at http://localhost.c: 9000/monitor import nodemailer from "nodemailer" ; const transporter = nodemailer.createTransport({ host: 'inbucket' , port: 2500 }); await transporter.sendMail({ to: "[email protected]" , html: "<p>Hello there</p>" , subject: "Email to Inbucket" , from: "[email protected]" , });

Demo: real-time email reader library Inbucket API v1 does not have an interface to retrieve new email in real time. We have to write our own library leveraging websocket connection of inbucket private API. Demo library open-sourced on: https://github.com/groovetch/inbucket-gt-client https://www.npmjs.com/package/@cute-me-on-repos/inbucket-gt-client

Demo: Integration and E2E testing Demonstration with Groove internal projects

Gracias ♡ ~ (( Q && A ) || SIGTERM )