The objective of this article is to present the creation of functional tests of webservices with Agilitest. We will not go back over what a web service is or its role in a Service Oriented Architecture because the literature is already abundant on the subject.
Why testing web services with Agilitest
It is enough to know that generally these services are very closely linked with the business processes to understand all the interest that there is to automate the tests within the framework of a campaign of functional tests or acceptance tests. The possibilities are endless but we can notably cite:
- Tests on several channels that allow you to carry out a transaction on a given terminal (Web on PC, App on Android ...), and then to verify the result of the operation using a dedicated web service.
- The opposite is also possible: allow you to verify that the data inserted using a web service is clearly visible in the user interface of your application.
- Web service tests of the "directory" type which must deliver the information necessary for a global process: carrying out sanity checks of these services before more global tests makes it possible to quickly identify the causes of failure.
- We can also cite the sanity checks of web services in production which make it possible to react quickly if the service were to stop responding under the conditions provided.
It is in this perspective that we considered that it was necessary to integrate the management of web services tests in Agilitest.
The multi-channel web service testing
Agilitest makes it possible to test web services on the two dominant technologies: SOAP, very structured with a return flow in XML and REST, more recent and very flexible, having a return flow in JSON.
The opening of the channel is done in the same way as any type of open channel in Agilitest, by the action "Start a channel". The user selects the address of his web service and possibly the desired authentication in HTTP.
Obviously, it is possible to have channels open on other applications at the same time allowing to retrieve information and carry out checks: the web service test channels under Agilitest are completely integrated with the channels on other technologies.
Graphical web service testing
All of the information returned by the web services is visible in a dedicated viewer of web services internal to Agilitest.
The call to a service is done using the REST web service or SOAP web service navigation action.
Calling a REST web service allows you to define which "method" is used to retrieve the information. It is then possible to add a header.
The return of the web service call is displayed in our viewer, and the Agilitest capture mode is automatically activated.
This allows you to directly select the response elements that we want to retrieve. The functioning of the Agilitest locator is identical to what is already implemented on other technologies: completely graphic, benefiting from the power of regular expressions, the use of the selected elements to generate actions is then done by drag-dropping the locator in the editor.
Agilitest supports the management of client certificates for the realization of web services tests, just copy the certificates in ".pfx" format in the under the "assets/certs" directory.
According to the certificate path in the "assets/certs" directory, the certificate will be applied to ATS scripts located according to the same hierarchical organization, eg. a certificate at the root of "assets/certs" will be applied for all ATS scripts, a certificate located in "assets/certs/ws/functional/domain" will be applied for all ATS scripts located from the "src/ats/functional/domain/" directory.
A Perfect integration
Finally, the integration of web service tests into Agilitest was made perfectly identical to the other technologies that we support: very graphic and benefiting from all of Agilitest's functionalities: channel management, variable management, sub- scripts and data-driven-testing, etc.
A set of more complex technical functions such as certificate management for secure connections was necessary and has also been implemented: this makes Agilitest a serious competitor of the most efficient solutions on the market, simplicity in addition.