Testing
Â
This document describes the steps to perform manual testing of a specific API in an API file.
Â
There can be a lot to consider in testing, such as: the operating system, network connectivity, different configurations options, etc. For this section of the documentation, we are only focusing on testing the API Logic.
To do thorough testing, you should examine the API logic and look for different code pathways.
Then, determine all the input parameter combinations that can be used to test each one of those pathways.
1. Navigate to the Profound.js IDE
2. Open the API fileÂ
3. At the bottom right, change to the Test tab
If you are experienced with Swagger UI, then this tool will be easy to pick up.
This tab shows the following:
Parameters section, which includes all of the input parameters along with the associated documentation and validation
Responses section, which includes the output documentation and output parameters
Â
Below is an example of a customer.api.json file, with the Get one customer API selected.Â
From this test view, we can gather that this API:
Has one path parameter named customerNumber that is required and must be an integer
You can also see this path parameter within the HTTP Path (this is an example of RESTful URI naming)
It returns a JSON object that contains a property called data. And the data property contains several more properties of different types.
Â
To Test the API, you would type in a valid customer number and press the Execute button.
Â
The Execute function validates the input parameters and then will attempt to call your API logic.
You will see a loading spinner while it calls your API.Â
Once the spinner goes away, this Responses area will be updated with the actual results.
You will see a Curl request, a Requested URL, and the actual Server response Status Code and Body.
You will notice that the Response body is not an exact match to the documented output parameters, because we're now looking at live response data:
Â
Testing Authenticated API
Note that, when testing an API that requires authentication, you have the option to sign in with a username/password or an API key (depending on your setup) by using the icon outlined below:Â