Avishai Shafir
VP Product, Lumigo.io
Serverless Testing
UIUI
UnitUnit
ComponentComponent
Testing
Pyramid
UIUI
TextUnit
ComponentComponent
Component
Integration
API
Component
Stay the same
UI
Stay the same
Unit
Testing
SLS
Pyramid
Local VS. Cloud
1. Serverless Framework
2. SAM (Lambda, APIGW, Step Functions)
3. Lambda-local
4. LocalStack
5. JawsLocalServer
6. https://github.com/sportarchive/aws-
lambda-python-local
7. https://github.com/lambci/docker-lambda
8. Azure Functions Core Tools
Local
Testing
Tools
1. Fast
2. Cheap
3. Easier to debug
ProsLocal
Testing
1. Latest ?
2. Different configuration
3. Not everything can be mocked
Cons
1. DynamoDB
2. S3
3. Kinesis
4. Cognito
Services – on CloudHybrid
1. API Gateway
2. Lambda
Functions – Local
Easy Debug, Short deploy time
• Production like
• Account per developer
• Cost
• Deploy time
Cloud
Testing
Test The
Limits
TWEAK YOUR FUNCTION’S COMPUTING POWER
TEST
https://www.jeremydaly.com/15-key-takeaways-from-the-serverless-talk-
at-aws-startup-day/
Correlation Between Components
When
There is
A Bug
TRACE Manually add trace-id
TRACE
Manually add trace-id
• https://opentracing.io/
• https://opencensus.io/
• https://www.jaegertracing.io/
Use distributed
tracing automation
platform like
Lumigo.io
TRACE
• Don’t test locally
• Large Packages – consider layers
• Load Test (serverless-artillery)
• Test cold  warm start
• Split Test  Dev  Prod accounts
• Test functions memory allocation
Summery
Thank You
Avishai@Lumigo.io
@avshafir
https://lumigo.io
Design Dev Test Deploy Monitor Troubleshoot Learn

Serverless testing @ serverlessdays Hamburg