Web services testing in SoapUI can be done for both SOAP and REST, in this article you will know how to use SoapUI to test SOA protocol based Web Service.
One of the advantages of SoapUI tool is it can be used by any one , they just need to know how an XML looks and how are the nodes structured in the XML file. Its been used by both automation test engineers and manual testers.
For this article we are using the below web service wsdl which is publicly available to perform web services testing.
The above web service is used to get the list of cities when a country name is passed as input and gets weather details when Country and City Name are provided as inputs using 2 of its methods.
Step by Step instructions to test web services in SoapUI
- Launch SoapUI tool
- Click on SOAP Icon to launch SOAP Project Wizard
- Enter Details of the project Name & WSDL which you want to use for testing in the respective fields and click on OK button.
- SoapUI tool parses the WSDL url and then shows you a tree structure with list of Projects > Processes > Methods > SOAP Requests.
- Double click request you want to submit or right click and select “Show Request Editor” in the context menu to work with the request XML in the editor.
- Every SOAP request will have nodes by names Envelope, Header and Body, you can see this now in the Request Editor window.
- Under the body you can see the list of Processes > Methods > Parameters in form of XML Nodes
- Here in this example, you can see one parameter “CountryName” for the method “GetCitiesByCountry”
- Enter United States as input for CountryName parameter.
- Click on Submit Icon to see the response.
- Once the Web Service request execution is completed, it returns with a response which is also in form of XML nodes.
- In this XML response, you can see the list of cities that are present for the give CountryName, in this example it is for Country: United States.
- You can now verify if your desired City name is present for the given country, this is how you test manually by viewing the XML response.
There are even options to insert Assertions so that the tool it self will check and let us know if a desired city name is present for the given country, instead of checking manually, this does not need much of coding as it is taken care by SoapUI tool itself. You will learn about this in the subsequent article.
In the mean time we would suggest you to practise submitting the request for the second method which is “GetWeather” by giving inputs for “City Name” & “Country Name”.
In case of any queries, please ask us through comments, we would be more than happy to help.