Anarchy.Toolkit.Testing.Aws
Part of Anarchy I/O Toolkit, a .NET developer platform · Pillar: Infrastructure · Layer: Testing kit · Package catalog
AWS messaging helpers for SNS/SQS integration tests, typically against LocalStack.
dotnet add package Anarchy.Toolkit.Testing.Aws
- Use
SqsHelperandAwsMessageBrokerHelperto work with test queues and messaging resources. SqsMessageFixturebuilds SQS messages, including gzip/zlib-compressed payloads.- Supply a suitable AWS or LocalStack endpoint and resources for your integration tests.
When to use it
Use this test-only package to exercise SNS/SQS publishing or message processing against a controlled AWS-compatible environment, or to construct SQS event fixtures without a live broker. It does not start LocalStack or provision infrastructure automatically for the whole test suite.
How to use it
- Start a dedicated LocalStack instance or configure a separate test AWS account and supply an application settings object implementing
IAwsAppSettings. - Construct
AwsMessageBrokerHelperwith those settings, and optionally anAppTelemetry(for exampleFixtureTelemetry.Telemetry) to receive its progress logs. Use its queue/topic preparation methods and, when needed, subscribe a queue to a topic before exercising the code under test. - Receive and assert messages with the helper; use
SqsMessageFixturewhen testing a Lambda handler with a constructedSQSEvent, including compressed bodies. - Dispose the helper and clean up test resources. Use unique names or isolate tests that purge queues, and never point destructive cleanup at production resources.
The generic SqsHelper<TAppSettings> can use the test settings of your settings type; see the testing guide for details. PrepareTopicAsync deletes and recreates an existing topic, so isolate resource names carefully.
See Infrastructure.Messaging.Aws, the testing conventions and the toolkit overview.
Releases
See the release notes for the complete release history.