Skip to content

This project aims to show how the code of a lambda should be structured, so it can be tested easily using Unit tests, Integration tests and Component tests.

Notifications You must be signed in to change notification settings

JensKnipper/testing-aws-lambdas

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

testing-aws-lambdas

About

This is a simple example of an AWS Serverless Lambda Function. It takes an image from a bucket in S3, creates a thumbnail of it and uploads it back to S3.

This project aims to show how the code of a lambda should be structured, so it can be tested easily using Unit tests, Integration tests and Component tests. Unit tests can easily be created using manual Dependency Injection. Integration and Component tests use a combination of Testcontainers and LocalStack to test the lambda independent of the AWS cloud.

Further reading

I held a talk about testing aws lambdas. This code is used for demonstration purposes in this talk. You can watch the talk online on my website.

Running the tests

  • including component tests ./mvnw verify

Prerequisites

  • the following programmes are required on your machine
    • Java 11
    • Docker

Further improvements

  • implement testing for other clouds
    • implement different EventHandlers for each cloud
    • implement Services analogue to S3Adapter
    • write tests

Thanks

I would like to thank my employer OpenValue for allowing me to publish the results of my research.

About

This project aims to show how the code of a lambda should be structured, so it can be tested easily using Unit tests, Integration tests and Component tests.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages