How to test web services?

Christophe Cressend
Blog > Automating with Agilitest
How to test web services?

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:

  1. Test manually
  2. Create your own automation code
  3. Use an off-the shelf automation tool like Agilitest to save time

Web Services automation testing involves the following steps:

  1. Understand the WSDL file
  2. Determine the operations that particular web service provides
  3. Determine the XML request format which need to be sent
  4. Determine the response XML format
  5. 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

Opening of a web services channel with Agilitest

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.

SOAP: Visualization of available webservices

Calling a service is done using the REST web service or SOAP web service navigation action.

Definition of the web service calling method: SOAP or JSON

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.

Navigation to a SOAP web service

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.

Display and capture of the result

Certificate management

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.

Want to give Agilitest a try?

See Agilitest in action. Divide by 5 the time needed to release a new version.

Scaling functional test automation for happy teams

  • From manual to automated tests
  • From test automation to smart test automation
  • Finding the right tools

Get great content updates from our team to your inbox.

Join thousands of subscribers. GDPR and CCPA compliant.