With the HTTP server running and to close out this article we will perform some rudimentary testing of the API.
There are many tools available to test an API ranging from basic through to full load testing but one common tool used by all developers is the popular Postman application. It is available in stand-alone binaries for all operating systems or as a very convenient Chrome browser plugin.
For those using Postman the ‘001 Basic’ directory contains a ‘test/’ subdirectory which includes a Postman collection file to import in to the application.
For others I will post screenshots below:
The image above demonstrates a successful GET request whilst the image below depicts a successful POST request.
To demonstrate our schema validation and handling of malformed data the picture below demonstrates an error response.
In future articles we will build upon this basic example and increase our knowledge and confidence in designing and developing APIs as well as more rigorous testing.