I had written this series of Posts on Testing Web services using UFT (QTP) at LearnQTP.com, I am just sharing the links for all the posts from this series, I hope this will surely help you in automating web services testing.

Web Services and QTP – Part 1: Testing Web Services Key Concepts

Web service is the way to connect different services together into a Service Oriented Architecture (SOA). Web services provide an application integration technology that can be used over internet and take Web Application to the next level.

 

W3C defines – A Web service is a software system designed to support interoperable machine-to-machine interaction over a network. It has an interface described in a machine-processable format (specifically WSDL). Other systems interact with the Web service in a manner prescribed by its description using SOAP messages, typically conveyed using HTTP with an XML serialization in conjunction with other Web-related standards.

Testing web services is no different than testing any other application/software program, but there are some unique challenges.

Web service based architecture is intrinsically distributed and is dependent on various stakeholders, which makes it difficult to establish availability and quality of service across the various stake holders. Most likely Web Services could be dependent on third party web services. And these third party web services can be changed without any information

Web services in an inter-enterprise SOA are so loosely coupled than the traditional architecture that tracking message route between different Web service stake holders is difficult.

Web services testing is basically the validation of interface points, messages and message formats which is quite different from testing the GUI.

Testing tools which are using GUI based automation is simply inadequate for Web services testing, but we don’t have to worry too much as we have QTP. Ian Fraser has well said it –

“The true beauty of QTP is that the only limitation is your imagination and ability to code in VBScript.”

HP Service Test and QTP Web Services Add-in are great solutions for Web Services testing. HP Service Test Management module plugs into Quality center. We need QTP Web Services add-in in order to work with web services which can be downloaded from HP Download Center.

See also  Execute Tests on Remote Desktop when minimized

Web Services and QTP – Part 2: Web Service Testing Wizard

When you are about to test a web service, make sure you have enabled Web Service Add-in for QTP. Once you have the add-in properly loaded you will see web service pane at Test Settings and Options. Web services toolkit option enables you to select a toolkit you want QTP to use for web service operations. For new tests and components, the default toolkit is the same as the toolkit set in the Web Services pane of the Options dialog box for learning Web Service objects.

QTP performs validation using the WS-I validation tool. The Web Services Interoperability Organization (WS-I) is an open industry organization chartered to establish Best Practices for Web services interoperability, for selected groups of Web services standards, across platforms, operating systems and programming languages.You will need to specify the path of validation tool in web services pane at option, and then you can access the tool by selecting Tools > validate WSDL.
images

Web Services and QTP- Part 3: Adding Web Service Test Object

QTP provides Web Service Add Object Wizard which helps you to add the test object into the repository. These web service test object behaves same as any other test objects while creating the steps in test i.e. we can access all its operations  in keyword view or in expert view.

To open the Add object Wizard click the object repository at toolbar or select Resources > Object Repository. Select Object > Web Service Add Object Wizard. The Web Service Add Object Wizard opens to show the Specify WSDL for Scanning screen.

Specify the URL for your WSDL as you did at Web Service Test Wizard and click Next.  It will now show you the select service screen. Here you can select the service and Port from the available list. And click finish.images

 

Web Services and QTP- Part4: Testing without Web Services Add-in

Yes, you got it right testing Web services can be done without using Web services add-in. All this is possible with the help of WinHTTP(Microsoft Windows HTTP service), which provides a high-level interface to the HTTP internet protocol.

We can use the com object WinHTTPRequest in our tests in order to invoke any operation to a web service. We will need to post the SOAP request to the web server using methods and properties ofWinHTTPRequest and we can get the corresponding response from the service.

See also  Synchronizing with readystate

Let us now try this out, open QTP and make sure you have not enabled Web Services Add-in in Add-in manager at startup.To retrieve the COM object of WinHTTP we use CreateObject method
images

6 COMMENTS

  1. When i try to load a URL for validation, An error message is populated as “The Selected Service is Invalid. Select a Different Service.” Please help in this case..

  2. Hi Saket,

    I need to automate REST API (JSON format) from UFT. There are three categories: POST, PATCH and GET. I am able to automate POST and GET, how to automate PATCH command.
    Here, the scenario is to update the data in web service if the outcome is not eligible. Please note, I do not have wsdl/wadl file, only services on swagger in json format.
    POST(Not eligible) –> PATCH(modify data in web service) –> GET(Check outcome: eligible/not eligible)

    Regards,
    Muskan Sood

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.