The objective of this article is to explain what is web service testing, how to test web service and how to create webservices functional tests 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.
What is Web Service Testing?
Web Services Testing is a type of software testing that validates Web services. The purpose of Web Services Testing is to check the functionality, reliability, performance, and security of an API (Application Program Interface). Web Service Testing is similar to unit testing in some cases. You can test a Webservice manually or create your own automation code or use an off-the shelf automation tools like Agilitest.
How to test a Web Service?
To test a web service, you can either:
- Test manually
- Create your own automation code
- Use an off-the shelf automation tool like Agilitest to save time
Web Services automation testing involves the following steps:
- Understand the WSDL file
- Determine the operations that particular web service provides
- Determine the XML request format which need to be sent
- Determine the response XML format
- Using a tool or writing code to send request and validate the response
Why testing web services
Web services are generally closely linked with business processes to understand the interest behind test automation and in the context of functional tests or acceptance tests campaigns. 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: web service testing allows you to verify that the inserted data using a web service is clearly visible in the user interface's application.
- Directory-type web service tests which must deliver the necessary information for a global process: carrying out sanity checks of these services before more expanding to more global tests makes it possible to quickly identify the failure causes.
- Another example is the sanity checks for web services in production, which allow a quick response if the service stops responding as expected.
It is in this perspective that we considered that it was necessary to integrate the management of web services tests in Agilitest.
Testing web services with Agilitest
Multi-channel web service testing
Agilitest makes it possible to test web services on 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.
Opening a 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 the desired HTTP authentication.
It is also possible to open channels on other applications at the same time - to retrieve additional 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
The returned information are visible in a dedicated internal web services viewer within Agilitest.
Calling 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 the web service call return is displayed in our viewer, and the Agilitest capture mode is automatically activated.
This allows you to directly select the response elements that you want to retrieve. The use of the Agilitest locator is identical to what is already implemented on other technologies: completely graphic, benefiting from the power of regular expressions... You can also drag and drop the locator in the editor to generate actions.
Agilitest supports client certificates management for web services tests action. Copy the certificates in ".pfx" format 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 features: 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. With simplicity in addition.