Testing a serverless project can be a challenging experience, since we rely on many different cloud services that are hard to emulate locally and, besides testing individual services, we need to test how they work together.
However, the practices that you have already used in traditional projects can all be used for serverless applications. To improve the quality of your software, you may use Test-Driven Development (TDD), Behavior-Driven Development (BDD), or any other development process that fundamentally relies on automating tests. Although we don't have access to the machines that will execute the code, we can simulate many things locally and we can run integrations tests from time to time to assert that everything works as expected.
In the following sections, we are going to see how to create tests for the backend and frontend. To make this topic simpler, we are going to create tests for trivial functions. If you want more extensive examples, you can browse the...