aws-smithy-mocks
This package allows testing clients generated by smithy-rs (including all packages of the AWS Rust SDK) by using interceptors to return stub responses. This approach is quite useful for testing both happy-path and simple error scenarios and avoids the need for mocking the entire client or using traits.
As an example, consider this simple usage with S3:
async
You can find more examples in the tests folder of this crate.
Shortcomings of this approach
This approach is not well suited for testing precise error handling, especially when considering retries or interactions with HTTP responses—This approach hijacks the request response flow entirely and is not a faithful model in these cases.
If you need to test behavior around retries or connection management, you should use HTTP-connection based mocking instead.
This crate is part of the AWS SDK for Rust and the smithy-rs code generator.