How to test web services?
In the third part of Web Services testing tutorial, we are going to discuss – how to test web services? Web services are integral part of any enterprise application that makes testing of web services important. In this article, we are going to discuss the manual testing approach for web services.
Web Services Testing
Web services testing poses slightly different challenges as compared to testing of a web application. There are no screens available and that makes manual testing of web services a little cumbersome as compared to other forms of testing. In this article, we are going to explain the manual testing approach for testing web services.
Web services can be used in a web application or a desktop application. A UI screen may use the web services to get values or perform some tasks asynchronously.
How to test web services
Web services are part of a software development project and they are developed as independent units. Testing a web service independently will involve testing of functionality of the web service. This form of testing is very similar to functional testing of any screen. We can create the test cases comprising of test data and conditions.
Let’s take an example web service to test it. W3 Schools provide some sample web services like Celsius to Fahrenheit conversion and vice versa. We have used CelsiusToFahrenheit web service for this article. When you click on this link, you will see the default interface of the web service, if web service is created correctly.
This page also shows the request and the response format. If you look at the request format, you can see the following section in the SOAP request:
Preparing Test data for testing web service
There is just one input data required and that is <Celsius>. The web services interface, by default, presents this field to input the data and test it. To test this web service, lets create some test data. I am sure you must be remembering the formula for conversion:
T(°F) = T(°C) × 1.8 + 32
Using the above formula, we create the following test data and expected results. You can notice that I have used both positive and negative test data.
(Temp in Celsius)
|Expected Result||Actual Result|
Preparing Test cases for testing web service
Using the identified test data, we can prepare test cases for testing the web service with valid and invalid data. Some of the test cases are shown below:
To test the web service, simply enter the input values and click on “Invoke” button. You can see the result as shown below:
In the next part of this how to guide, we are going to discuss the automation testing approach for testing a web approach.