The best ways to test your serverless applications
- For the serverless functions you write, test for each of the following risks: configuration (databases, tables, access rights), technical workflow (parsing and using incoming requests, handling of successful responses and errors), business logic and integration (reading incoming request structures, storage order in databases).
- Break up functions into hexagonal architecture (ports and adapters) with separation of concerns through layers of responsibility.
- For unit tests, use a local adapter or mock as an adapter to test the function business layer in isolation.
- Use adapters to simulate to test integration with third-party end services. Save memory and time by testing not for full integration but file storage integration with the in-memory adapter.
- For proper monitoring of integrations, use back-end tools such as IOpipe, Thundra, Dashbird, Epsagon, etc., and front-end tools such as Sentry or Rollbar. You can also use an open-source error tracking app such as Desole that you install in your AWS account.
Full post here, 10 mins read