Testing the service

Testing this service is relatively simple. We can skip unit tests as we are not writing functions suited for those. It makes more sense to write a Postman test suite that will test the API endpoints. In Chapter 8Testing Microservices you learned how to do that. So, let's apply that here, as follows:

  1. Open Postman and create a new test suite.
  2. Set up authentication so that we can test the admin functions as well.
  3. Go through the preceding routes and add a test for each one of them.
  4. Let Postman test this service and verify that it works as expected.
You can find the entire test suite in the GitHub repository for this chapter: https://github.com/PacktPublishing/Hands-On-Microservices-with-Swift-5/tree/master/Chapter 9/ProductService ...

Get Hands-On Swift 5 Microservices Development now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.