8 Automated testing for microservices
This chapter covers:
- Automated testing of microservices
- Unit testing and integration testing with Jest
- End to end testing with Cypress
- Adding automated testing to your continuous delivery pipeline
To this point in the book while building microservices we have been testing our code manually. In this chapter though we’ll shift up a gear and learn how to apply automated testing to our microservices.
So far we have primarily done our testing by running our code and visually inspecting the output. In various chapters we used our web browser, output from the command line or changes in the local file system to check the results of our code. In other chapters we used more specific tools, like Robo3T in chapter 3 or the RabbitMQ dashboard in chapter 5.
Methods of manual testing are many and varied. I want you to know that manual testing is ok and perfectly valid. You should start with manual testing and continue with it until you are comfortable enough to use automated testing and your product is well enough understood that it’s worth making the investment in automated testing. I can recommend tools for manual testing like Postman or REST Client for Visual Studio Code. These will help you to manually test your REST APIs.