11 Testing, Testing, 1, 2, 3

 

This chapter covers

  • Testing serverless applications—the approach
  • Writing testable serverless functions
  • Running automated tests locally

Application development is not an easy and carefree process. Even with careful implementation and checking, software bugs can slip through and put your company or your users at risk. In the past couple of decades, bug prevention and software testing have become imperative. As the old English proverb says, an ounce of prevention is worth a pound of cure.

Now with serverless, software testing seems to have gained a new layer of complexity. Having no server configuration, along with using AWS Lambda and API Gateway, can make testing your applications look scary. This chapter’s goal is to show how, with just a minor change to your application testing approach, you can test your serverless applications as easily as you did those that were server-hosted.

11.1 Testing server-hosted and serverless applications

11.2 How to approach testing serverless applications

11.3 Preparation

11.4 Unit tests

11.5 Mocking your serverless functions

11.6 Integration tests

11.7 Other types of automated testing

11.8 A step beyond: Writing testable serverless functions

11.9 Taste it!

11.9.1 Exercise

11.9.2 Solution

Summary