Announcing the Alpha Release of sls-test-tools — Bringing Simplicity to Serverless Integration Testing

Ben Ellerby
May 14 · 2 min read

Today we’re very pleased to announce the alpha release of sls-test-tools — providing a range of utilities, setup, teardown and assertions to make it easier to write effective and high quality integration tests for Serverless architectures on AWS.

We have a strong view that, where possible, testing of Serverless architectures should happen on the real underlying services, avoid mocks wherever possible. Although Serverless allows for ephemeral (short-lived) architectures to be deployed, making assertions can end up being complex and verbose — reducing test readability.

Packaged as an npm module, sls-test-tools provides a set of custom jest matchers to bring simplicity to integration testing. Initially we’ve added matchers to help integration testing of EventBridge based integrations — following the SQS interception approach we’ve shared previously.
Using sls-test-tools the underling mechanisms of this approach are completely abstracted — resulting in quick to write and highly readable tests:

const eventBridgeEvents = await eventBridge.getEvents()
expect(eventBridgeEvents).toHaveEvent(); expect(eventBridgeEvents).toHaveEventWithSource("order.created");
(See full example in the sls-test-tools README)

We’re in the early stages of open-sourcing our testing strategies, and sls-test-tools is definitely going to evolve and change (this is just the alpha).
Your feedback is very welcome — we’ll be monitoring GitHub Issues regularly, along with supporting any Pull Requests.

We’re excited to be adding more matchers from our best practices, as well as involving community contributions. In addition, sls-test-tools is initially bringing assertions to jest — this is great for JS/TS developers, but we’ll be keen to add further language support as the tool matures.

Are you as excited as we are? ⭐️ the repository and let us know!

Thanks to Sarah Hamilton and Alex White for helping to get this out!

Serverless Transformation is a Theodo initiative. Theodo helps companies leverage Serverless through expert delivery and training teams.
Learn more about Theodo and speak to one of our teams today!

Serverless Transformation

Serverless Tools, Techniques, and Case Studies

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

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