By Vasanta Bagalavar on Mar 30, 2016 4:06:45 AM
Web service is a means to establish the communication/connection between two or more application servers and exchange the data between the communicated servers or machine.
Web services are mainly built on Service Oriented Architecture (SOA) technology and communicate using HTTP or SOAP protocol.
Web services are platform and technology independent.
Types of Web Service
Web services can be implemented in different ways
- SOAP (Simple Object Access Protocol)
- REST (Representational State Transfer Architecture)
SOAP: Simple Object Access Protocol is a standard protocol which uses the XML format for sending and receiving web service requests and responses. SOAP messages are exchanged between the applications within the SOAP envelops in WSDL format.
REST: REST is an architecture that runs over HTTP. Rest uses GET, PUT, POST and DELETE operation calls. Rest supports both XML and JSON format. RESTFUL applications use HTTP built-in headers to carry meta-information.
Web Service Testing steps
Web service testing basically involves the following activities:
- Understand the WSDL file format
- Determine the response XML format
- Determine the XML request format which we need to send
- Determine the operations provided by the web service
- Send web service request and validate the response
Web Service Testing for Soap service using SoapUI (Open Source)
We will consider the currency conversion utility as an example
- Launch SoapUI tool -> Go to File -> New Soap Project.
- Enter the project Name and the WSDL URL
- Click OK button.
- Expand the first request on left pane and double -> click on the 'Request1'. It will display the SOAP request in the XML format on right pane.
- Enter the value for “From Currency” and “To Currency” on request xml.
- Click on the submit button.
- Response output XML will be displayed in the right side pane based on input value provided.
- We need to validate that the output response has the proper currency conversion based on the input currency provided.
Web Service Testing for REST service using SoapUI (Open Source)
- Launch SoapUI tool -> Go to File -> New Rest Project.
- Enter the Google Map API location in the given text field http://maps.googleapis.com/maps/api/geocode/xml?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=false
- Click OK button
SoapUI will create project tree along with resources, services, methods, and endpoint with input request in the editor. See below
- When we click on the parameter in parameters section, parameters used in the service are displayed in the separate popup window as shown above.
- Click on the Run icon. SoapUI generates the following output for the given endpoint in the form of XML.
- We need to validate that the output has the proper location for the given address.
Typical failures noticed during Web Service Testing
- Fail to handle server connections.
- Security issues – Firewall, Authentication failure
- Performance Issues while API request and response time is too high
- Fail to handle expected response output
- SOAP and REST faults
- Input request data is invalid
- Response output data is not as expected.
Web Services Testing Challenges:
- Web service call sequencing, parameter selection and parameter combination
- Web service is GUI-less testing which makes it difficult to provide the input values
- Difficult to understand web service calls and WSDL without programming knowledge
- Unknown exceptions thrown from the service.