Tuesday, 25 January 2011


Apart from Web Services Testing Wizard we discussed in last part, let’s find out what are other possible ways to work with Web services in QTP. What about adding Web services objects directly into object repository and use the test object to add steps in test or component.
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 WizardThe Web Service Add Object Wizard opens to show the Specify WSDL for Scanning screen.
Specify WSDL for scanning
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.
Select Service
Close the Object Repository and the test object is now ready to use in your test. To use a web service test object use ‘WebService(<Test Object>), and you can access any of the operations available.
Accessing Web service Test Object in test
so as of now, we have seen that we add a test object in the repository and can do further processing. Let’s now see how can test a web service without adding the test object in the repository.
A web service test object requires three main description properties to invoke a method. Which are –
  1. WSDL
  2. Service and
  3. Port
Refer object repository for already added test object
Test Object Details
if we can define these in the script we will be able to access the methods of web services.
WebService(“wsdl:=<your wsdl>”,”service:=<your service>”,”port:=<your port>”)
So in order to invoke the method CelsiusToFahrenheit from the WSDL used in earlier parts you can have the statement in the script as –
Desc2 = "service:=TempConvert"
Desc3 = "port:=TempConvertSoap"
' Call to the WebService
Fahrenheitval = WebService(Desc1, Desc2, Desc3).CelsiusToFahrenheit("25")
msgbox Fahrenheitval
Which gives you the required output as 77.
All the other available operations can be carried out with this approach.
You can follow the entire web services testing and QTP here.

0 comments:

Post a Comment

TrainingHUB. Powered by Blogger.

Total Pageviews

THE BEST QTP TRAINING INSTITUTE IN HYDERABAD

QTP Training in hyderabad

Sql Tutorial

Popular Posts

Our Facebook Page

TrainingHUB

Followers