Being in the development branch, to perform the testing of our API, we have enabled the following sections:
Definition quality – sonarqube: #
In this section we can visualize the definition file associated to the API, as well as the qualification of our API.
By accessing the menu, we can run , update as well as edit the API definition. We will have the option to rescan the API in case we have made modifications in the definition, as well as to visualize the errors and vulnerabilities within the file itself to have a clearer view of the problem.
We will be able to make modifications in the definition of our API directly to save it later, to do this we must access the «Definition» section.
In the hamburger icon we have different options, such as hide error details, download option, upload a file for update (it has a drop-down with two options: local file or URL), show swagger view, show editor view.
If we select «Editor» view we can edit the file more comfortably in the tool itself and save these changes:
If we select Swagger view:
In the Swagger view, the rules that we have defined in our style guide and that have not been fulfilled will be displayed. Clicking on the name of the rule will open a view with an explanation of the selected rule with an example of correct and incorrect compilation.
On the other hand, in case we want to replace the file, we can click on the «Upload file» button, where the following dialog will be opened to choose the import source.
We also have the possibility to download the current API file using the «Download» option. This is useful in case you have edited the definition from API Quality, and you want to have a local copy with the last changes made.
Mock server – microcks #
A drop-down can be displayed with the index and score classification.
We can launch our stage as well as update it.
Clicking on the URL redirects us to the microcks page.
Contract tests – swagger2postman #
Allows to generate postman collections for testing purposes.
In this section we can generate our Postman collections. To do so, click on the Configuration button and then on Generate collections.
When you click on it, a dialog will open where we will be asked, with the required fields, first, to name the Host we want to generate, then the Port. Then we also have the option to generate these read-only endpoints, and finally click on the create button.
Once the collections have been generated, we will have the option to download them by clicking on the Download Collections button. If desired, an environment can also be edited.
Quality tests – newman #
Performs tests based on a collection of postman.
To finish the testing cycle of our API, we must click on configuration and we have available the section Quality Tests – «newman».
To run a test, click on the Run test button.
Figura 80. Ejecutar test Newman
Next, a dialog will open where we will have to include the json file of the Postman collection to examine, as well as the environment file associated to it to perform the test, once uploaded we will be able to launch it and update it,
:
Once the report is generated, a view like the following one will be displayed to examine the results:
Microservices #
APIQuality allows you to generate the archetype corresponding to the imported definition in a specific language. This microservice will be available in the API definition repository.
To generate the archetype, we will have to choose among the languages available in the tool, currently Java Spring Boot or C#. NET, and click on the Generate button. It is important that the definition contains the correct structure so that the archetype can be generated; otherwise, an error will be returned.
To do this, click on configuration, it will take us to a section where we can select in which language we want to use the following language:
Once the archetype has been generated, the Download button will be enabled, which allows you to have a local copy of the base project.
Deployment in Api Manager – kong, Deployment in Api Manager – mulesoft, Deployment in Api Manager – wso2:v4, Deployment in Api Manager – wso2:v3, Deployment in Api Manager – aws #
The last section of the API First cycle is the deployment. To deploy an API we will choose the API Manager in which we want to deploy it, click on the menu, the option «Execute stage» will be displayed for its deployment.
To deploy an API, click on the Deploy API button:
This will open a dialog where we will have to select the API Manager, depending on the one we choose other options will be displayed where we want to deploy our API. We will also display Backend service URL, which is not mandatory.
Once deployed, we will start to see the status of our API.
Clicking on the delete icon will open a dialog to confirm that you want to delete the displayed API.
When trying to deploy an API you must take into account that only those API Managers previously configured will be available.