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

In the earlier part of WebServices testing with QTP, we have gone through the basic concept required for web service testing. In this part we will use those concepts to test the web service using QTP.

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.

Let us now see Web Service Testing Wizard in QTP. To open the wizard click the web services wizard in toolbar or select Automation > Web Service Testing Wizard.

Web Services Testing Wizard Menu

You will see a Welcome screen which provides you the overview of wizard. You can choose whether you want the welcome screen when running the wizard or not.

Clicking on Next button you will get the screen for WSDL Scanning. Here you will need to specify the WSDL, which can be a URL, a WSDL file or it could be in your repository which has added earlier. Select the Include security settings in the generated Web service test check box if you want to specify the security tokens that are required for communication with the Web service you want to test.

Specify WSDL for Scanning

Click Next, the next screen that pops up is depending on your selection in the last screen. If you have specified a secure WSDL, the Network Credentials dialog box opens. Enter the login details required to access the WSDL and click OK. The Web Service Testing Wizard – Set Security Options Screen opens. If you selected the Include security settings in the generated Web service test check box, the Web Service Testing Wizard – Set Security Options Screen opens. If you do not need to specify security settings, the Web Service Testing Wizard – Select Service and Operations Screen opens.

Specify the WSDL from W3Cschools.com which I have mentioned in the last part http://www.w3schools.com/webservices/tempconvert.asmx?wsdl . Clicking on Next, Select Service and Operations Screen opens.

Select Service an operations

You will see the two operations here select one of the operations and move it to selected Operations list. And click next. The next screen comes is the Summary screen. You can automatically insert XML checkpoints by selecting Add XML checkpoint after each relevant step (selected by default). Selecting this check box adds an XML checkpoint for each step in the test that has a return value or an output argument.

Web Services Test Wizard Summary

Click Finish and The WebService test object is stored in the local object repository, and the defined steps are converted to the proper syntax and inserted into your test.

Go to your Object repository. You will see your web services test object and the xml checkpoint added. Selecting the test object, you can see the details of this object like wsdl, port, and service. You can see the following script generated in your test.

CelsiusToFahrenheit= WebService("TempConvertService").CelsiusToFahrenheit("string (Autogenerated)")
WebService("TempConvertService").Check CheckPoint("CelsiusToFahrenheit")

You can see that the parameters are not yet passed, it is auto generated by the wizard (“string (Autogenerated)”), and you will need to specify this parameter before executing this. Something like below and execute.

CelsiusToFahrenheit = WebService("TempConvertService").CelsiusToFahrenheit("25")
WebService("TempConvertService").Check CheckPoint("CelsiusToFahrenheit")

In the Test Result you will find that your test failed. Click on Web Service object you can see the SOAP request and response there as described in the last part.

Response Result

The web service has actually output the result in the response i.e. 77; actually it has failed at check point.

XML Check point result view

This is because we have not configured the xml checkpoint for the expected result. So if you have selected to add xml checkpoint at wizard then make sure you have configured it.

Note:-

  • Make sure you run Web service tests using the same toolkit with which the test was created.
  • QTP includes Maintenance Run Mode, which is not supported for applications such as Web services, which do not have a user interface.
  • WSDL Validation tool is a third-party application that is not provided with QuickTest. You can download Interoperability Testing Tools 1.1 from the Web Services Interoperability Organization Web site at http://www.ws-i.org and it must be installed locally.

22 comments ↓

#1 manoj on 04.28.10 at 10:42

Hey,

Very nice article keep posting more.
Please let me know from where can download trial Web-service add ins?

#2 Saket on 04.29.10 at 12:55

Thanks Manoj,
You can download it from https://h10078.www1.hp.com/cda/hpdc/display/main/register.jsp? (link provide in Part 1)
HP download Center[/url] (requires login)

#3 Anoop on 04.29.10 at 13:16

Really gud one Saket.
Waiting for the next part. :)

#4 Web Services and QTP- Part 3: Adding Web Service Test Object | Learn QTP on 05.04.10 at 12:08

[...] ← Web Services and QTP – Part 2: Web Service Testing Wizard [...]

#5 Nileshk on 05.07.10 at 15:30

Very useful Artical Saket

#6 Saket on 05.18.10 at 09:47

Thanks Nilesh,
I am glad you found this useful.

#7 Prarthana on 05.19.10 at 13:21

Hi Ankur,

When I try to click on “WebServices Testing Wizard” button, I get “Failed to launch” error message. Can you pls tell me why is it coming and what is the resolution.

Thanks

#8 Saket on 05.20.10 at 09:54

Prarthana – may be the web services add-in has not installed properly, can you try installing it again and let me know.

#9 smith on 06.13.10 at 05:31

Hi Saket,
Firstly thanks for the nice article.
I was trying to experiment with the WS add-in, but seem to have run into some issue. I am trying to follow the same steps mentioned above, but once I provide the WSDL path(URL from the w3schools), QTP is throwing an error saying – Proxy authentication required. Can you please let me know if I am missing something here?

#10 Saket Kumar on 06.16.10 at 09:50

It looks like a network restriction on your computer, are you able to access w3schools webservice directly on your browser?

#11 Srinath Bharadwaj on 07.10.10 at 22:55

Saket,

I am able to access the wsdl directly through browser, but QTP throws “Proxy authentication required” when I go through Web service wizard. Any idea what may be an issue here?

#12 sripath on 07.13.10 at 18:55

i am able to access the wsdl directly through browser, but QTP throws “Proxy authentication required” when I go through Web service wizard. Any idea what may be an issue here? Please suggest how to proceed further

#13 Sriharsha on 11.01.10 at 22:29

Hi saket,

How can i store and access xml response values ?

#14 shan on 12.27.10 at 09:12

I am new to QTP,I have web service add-in installed, I need to write a QTP script to send web service request and receive the response.I need to parameterize the everywhere in the script as much as possible.Can anyone help me.

#15 Sambhavi on 05.31.11 at 11:47

Hi ankur ,

How to pass this test by configuring the XML Check Point.

Thank You.

#16 Ram's on 08.24.11 at 12:45

Nice article Saketh. IT is most useful

#17 Sarika on 08.29.11 at 09:30

Hi Saket,

Thanks a lot for this wonderful web services series. All the articals were very much useful.

In my project, I tried to upload wcf file in a web service wizard and after scanning its throwing error as Invalid wsdl file.

Could you please tell me if QTP 10.0 supports wcf?

Thanks

#18 Asha on 09.23.11 at 01:27

Hi Saket,

Please let me know if QTP supports WCF services.
Also provide me the info on adding a endpoint to WCF WSDL.

Thanks,
Asha

#19 Sandra on 10.14.11 at 13:05

Hi,

Can I test more than one web service in a same test?
I need to connect to one web service for authentication and then to test methods from another.

Thank you in Advance!
BR,
Sandra

#20 H Naderi on 11.01.11 at 04:06

Saket,

great article – what if there isn’t a WSDL file? (ie RESTful Web Services)

thanks!

#21 Steve on 01.20.12 at 22:06

So we can post issues and there’s no moderation & instruction on resolving our issues?

#22 Ankur on 01.31.12 at 13:47

@Steve: You can ask questions on QTP forums

Leave a Comment