Unit Testing your Serverless Rust Applications

Опубликовано: 19 Июнь 2026
на канале: James Eastham
770
24

Hi, I'm James. Welcome to another video in this series on building serverless applications on AWS with Rust.

Unit testing is a vital part of the software development life cycle. Providing fast feedback to developers to ensure your business logic is working as it should is essential for a productive workflow. In this video you will learn how to apply good testing practices when building serverless applications with AWS Lambda, Rust and the AWS SAM CLI.

There are a couple of different methods for unit testing with Rust. One, is a mock TestConnection client provided by AWS for testing AWS SDK's. The other, is the mockall crate which allows simple mocking of Rust Traits.

00:00 - Introduction
00:30 - What are we building?
01:10 - Test AWS SDK's
01:50 - Mock AWS SDK calls
04:10 - Testing AWS SDK errors
06:40 - Introducing Mockall
07:25 - Traits for shared code
09:40 - Test using Mockall
11:25 - Testing Errors with Mockall
13:00 - Test Options Side by Side
13:55 - Which Option to Use?

Links
GitHub Link - https://github.com/jeastham1993/learn...
Install Rust - https://www.rust-lang.org/tools/install
Install Cargo Lambda - https://www.cargo-lambda.info/guide/g...
Install AWS SAM - https://docs.aws.amazon.com/serverles...
AWS Rust Testing - https://docs.aws.amazon.com/sdk-for-r...
Mockall - https://docs.rs/mockall/latest/mockall/

Web - https://jameseastham.co.uk
Twitter -   / plantpowerjames  
LinkedIn -   / james-eastham