JavaScript Menu by Deluxe-Menu.com
   Considerations for Working with the Web Services Add-in

QuickTest Professional supports keyword-driven testing on your Web services. This means that after you add a WebService test object to your object repository, you can access all of the operations that the Web service supports from the Operation column of the Keyword View, the Operation box in the Step Generator, or by using IntelliSense in the Expert View.

You can use the QuickTest Professional Web Services Add-in to test your Web service using familiar QuickTest functionality, without the need for extensive knowledge of your Web service architecture. For example, you can use QuickTest Professional to invoke the operations of your Web service and verify returned XML data using special functionality that has been customized for Web services. You can use the specialized WebService test object operations to control the way in which QuickTest communicates with your service, including working with security, configuration, headers, and attachments.

You can also use the Web Services Add-in together with any other QuickTest add-ins to create tests that test both the direct communications with your Web service and the front-end application that reflects the results of these communications.

   Understanding the Web Service Testing Wizard

The Web Service Testing Wizard helps you select the WSDL source, set security options, and specify the Web service, port, and operations you want to test. For tests, you can also choose to automatically insert checkpoints with the proper syntax for each selected operation. When you finish, the wizard creates a WebService test object that represents the Web service and port you want to test and inserts the relevant steps directly into your test or component.

You can then update the generated steps of your test or component by replacing the generated argument values with valid values, updating the expected values, and selecting the nodes you want to check in your checkpoints (tests only). After you perform these steps, you can update the data by performing an update run You can also enhance the generated test or component by inserting additional steps or, for tests, adding programming logic.

Note: QuickTest includes Maintenance Run Mode, which is not supported for applications such as Web services, which do not have a user interface.

The Web Service Testing Wizard includes the following screens:

Welcome to the Web Service Testing Wizard Screen.. Provides an overview of the wizard steps.
Web Service Testing Wizard - Specify WSDL for Scanning Screen.. Enables you to select the source of the test object you want to include in the generated steps.
Web Service Testing Wizard - Set Security Options Screen.. Enables you to select the security tokens required for communication with the Web service you want to test, and to set their property values.
Web Service Testing Wizard - Summary Screen.. Displays a summary of your selections and for tests, enables you to choose whether to add checkpoints after each relevant operation step.

Welcome to the Web Service Testing Wizard Screen

WS Testing Wizard
Welcome to the web service testing wizard screen
The Welcome to the Web Service Testing Wizard screen is the first screen displayed when you open the wizard. The screen describes the steps in the wizard. You can choose not to display the welcome screen when you open the wizard. Clear the Show Welcome screen when running the wizard check box in this screen, or select the Tools / Options / Web Services node in the QuickTest window and then clear Show Welcome step in Web Service Testing Wizard in the Web Services pane of the Options dialog box.

Web Service Testing Wizard - Specify WSDL for Scanning Screen

WS Testing Wizard
WS testing wizard - specify WSDL for scanning screen
The Specify WSDL for Scanning screen enables you to select the required WSDL source. The source can be a URL, a WSDL file, or an existing WebService test object from the object repository.

Note: The first time you open the Web Service Testing Wizard, the URL box is empty. On subsequent uses of the wizard, the Specify WSDL for Scanning screen opens with the same settings as those set in the previous wizard session.

By default, the WSDL source is analyzed using the .NET Framework 2.0 WSE 3.0 toolkit. You can change the toolkit if required.

In the Specify WSDL for Scanning screen, specify the WSDL source and whether you want to include security settings in your Web service test, as follows: Select a radio button according to the WSDL source you want to test. Then enter the source. You can click the down arrow next to each box to view and select recently used items.

If you want to locate a URL source on a Web server, click the Navigate button next to the URL box to open Microsoft Internet Explorer. The button name changes to Capture. Navigate to the required URL (WSDL file). Minimize the browser and click Capture or close the browser. The URL address is automatically entered in the URL box.
If you want to locate a WSDL file, click Browse next to the File box to open the Browse for WSDL File dialog box. Browse to the required file.
Tip: From the Attachments of type list in the Browse for WSDL File dialog box (or Files of type list when choosing a file in the file system), you can choose to view only .wsdl files, only .xml files, or view all the files in the selected location
If you want to create steps for a service (and port) that has already been defined as a test object in one of the repositories associated with the current action or component (via its application area), select Repository, and then select the relevant test object. This option enables QuickTest to access the WebService object directly, without processing the WSDL file, thus saving processing time as QuickTest identifies the service and its operations.

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.

Web Service Testing Wizard - Set Security Options Screen

WS Testing Wizard
WS testing wizard - set security settings
The Set Security Options screen enables you to specify the security tokens that are needed for communication with the Web service you want to test. For each selected security token, you also set its property values. After you complete the wizard, QuickTest converts your selections into one or more test steps, containing the corresponding operations and property values. For example, if you select X.509 Token, QuickTest might add steps similar to the following: tokenID = WebService("FlightNetWebService").Security.AddX509Token( micRequestToken, XMLWarehouse("Certificate") ) Additionally, if you select Client Certificate or X.509 Token in the Security tokens area, the wizard loads the certificate that you specify in the Token properties area and saves it with the test. The wizard stores the raw data of the certificate as a binary string in a new XML structure. During a run session, QuickTest uses this certificate and does not load it from the external source that you specified. You can access the certificate from the XML Warehouse pane in the Settings dialog box

In the Security tokens area, select the check boxes for the security tokens needed for communication with the Web service you want to test. You can highlight any token to view its description in the Description area. When you highlight a token, its properties are displayed in the Token properties area. (Note that highlighting the token does not select its check box.) You can select as many security tokens as needed. The following security tokens are available:

Network Credential : A network credential used for password-based authentication schemes, such as basic, digest, NTLM, and Kerberos authentication. This token is relevant only for Web service request messages.
Client Certificate : A client certificate used mostly when a client uses the SSL3.0/PCT1 protocol to connect to a server, and the server requires client certificates for mutual authentication.
Username token : Username and password security credentials. includes the Token Direction, Send Mode and Protection mode.
X.509 Token: An X.509 certificate used for signing and/or encrypting Web service request messages when a server's public certificate is required.

Web Service Testing Wizard - Select Service and Operations Screen

WS Testing Wizard
WS testing wizard - select service and operations screen
The Select Service and Operations screen enables you to select a service and a port from the source WSDL you specified in the Specify WSDL screen. The test object that the wizard generates represents this specific service and port. You can then select the operations to be included in the test or component steps from the list of available operations supported by that Web service. You can also arrange them in the required testing order. From the Service name list and Port name list, select the service and port that you want to test. The name of the service you select is also used as the default name of the created test object. If a description of the Web service is available, it is displayed as a tooltip when the cursor is positioned over the service name.

In the Available Operations  list, double-click each operation you want to include, or select an operation and click the right arrow button > to add it to the Selected Operations list. You can add the same operation more than once. To remove an operation from the Selected Operations list, you can double-click it in the Selected Operations list or select the operation and click the left arrow button <

Use the up and down arrows to sort the Selected Operations list into the required testing order.

Web Service Testing Wizard - Summary Screen

WS Testing Wizard
WS testing wizard - summary screen
The Web Service Testing Wizard Summary screen provides a summary of the operations for which the wizard will add steps according to your selections. When working with tests, 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. 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.

   WS-I Standards

You can instruct QuickTest to analyze a specific WSDL source to check that it conforms to WS-I standards and complies with the WS-I Basic Profile.
Levels of conformance
Level A Conformance
Level A conformance icon, W3C-WAI Web Content Accessibility Guidelines 1.0
Level Double-A Conformance:
Level Double-A conformance icon, W3C-WAI Web Content Accessibility Guidelines 1.0
Level Triple-A Conformance:
Level Triple-A conformance icon, W3C-WAI Web Content Accessibility Guidelines 1.0
Note: QuickTest performs the validation using the WS-I validation tool, which 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. Note that it must be installed locally.

Download and install the WS-I Testing tool.

The Web Services Interoperability Organization (WS-I) is an organization founded to write best practices about the web services interoperability. Its WS-Basic Profile and WS-Basic Security Profile documents deals with some specifications and recommendations to prevent interoperability problems. They provide a toolkit which can be used to check if the services are compliants with the basic profile or not. The WS-I testing toolkit contains two tools:

The Monitor: It works as a proxy for web services requests and responses. An interceptor looks at the messages, and sends some informations to a Logger which persists them.
The analyzer: It analyses the logs generated by the monitor and analyse the traffic between the ckient and the server to determine if it is compliant. It can analyse WSDLs to check thier compliance, and can even analyse an UDDI repository.

The tool which will interest us today is the WSDL Analyzer, and its ability to check a WSDL and generate a report about its compliance with the WSI-Basic Profile. The report contains the result of the test, and the uncompliant points if there are.

You can run the validation tool manually in QuickTest, selecting Tools / Validate WSDL to open the Validate WSDL dialog box. You can also validate that the WSDL source conforms to WS-I standards programmatically using either the WebService.ValidateWSDL method or the WSUtil.ValidateWSDL method.

When the validation is complete, you can view the validation results, which indicate whether the file conforms to WS-I profile guidelines. Note that it is possible that your Web service tests or components on the specified WSDL will run successfully even if they do not conform to these guidelines

Before you can use the WS-I validation tool, you need to specify the location of the WS-I validation tool. You do this in the Web Services pane of the Options dialog box ( Tools / Options / Web Services node).

Note: When you run the WS-I validation tool, QuickTest accesses the WSDL. If the WSDL you are validating is located on a secure server, or if the network connection is secure, you must save the WSDL and any additional resources referenced by the WSDL to a non-secure location (such as a local drive) before running the WS-I validation tool.

in the WS-I Deliverables section of WS-I site on the left menu, select the Testing Tools option. in the Testing Tools Filter , select the Show only Test Tools type item and click the Apply Filter button. locate the post about Interoperability Testing Tools 1.1 :

Download your requested toolkit ( Java or .NET ) to your hard drive and unzip the file. locate the wsi-test-tools folder and copy the folder to a known location.
   Setting Web Services Test Options

Before you can use the WS-I validation tool, you need to specify the location of the WS-I validation tool. You do this in the Web Services pane of the Options dialog box. The Web services options enable you to specify the toolkit that QuickTest uses when learning WebService test objects, specify WS-I validation preferences, and set additional display settings for the Web Service Testing Wizard

Learn new test objects using the following toolkit

Specifies the toolkit you want QuickTest Professional to use when learning new WebService test objects:
.NET Framework 1.1 WSE 2.0
.NET Framework 2.0 WSE 3.0
Apache Axis 1.x
Tip: It is recommended to run Web service tests using the same toolkit with which the test was created.

WS-I validation tool location

Indicates the path containing the WS-I validation tool. Specify the root path of the wsi-test-tools folder ( and not the bin folder containing the executable file). The wsi-test-tools folder must be stored on the computer on which the WSDL is scanned. The WS-I validation tool tests Web service interoperability by checking compliance with the WS-I Basic Profile QuickTest uses the path specified here to perform validation checks in the Validate WSDL dialog box.
Web Services Options
WS-I Validation tool location

WS-I validation tool platform

Indicates the Web service client platform type—.NET or Java.

WS-I report options

Specifies the criteria for the assertion results to be included in the validation report. Test assertions are used by the WS-I validation tool to analyze whether a Web service conforms to WS-I standards. The following options are available.
Report all assertions. Reports the results of all assertions.
Report all assertions but passed assertions. Reports the results of all assertions except those that have a "passed" result.
Report only failed assertions. Reports only the results of assertions that have a "failed" result.
Note: You can use the WS-I validation tool to test Web service interoperability. It does this by checking compliance with the WS-I Basic Profile. The WS-I validation tool, Interoperability Testing Tools 1.1, is a third-party application and is not provided with QuickTest Professional.

Show Welcome screen in Web Service Testing Wizard

Specifies whether to display the Welcome screen when you open the Web Service Testing Wizard. You can also control this option by clearing the Show Welcome screen when running the wizard check box in the Welcome screen.

Display information message when Web Service Testing Wizard finishes

When you select an operation with input arguments while using the Web Service Testing Wizard, the wizard generates default values for the arguments. If this option is selected, then the wizard displays a message when you click Finish to remind you that you must replace the automatically generated argument values with valid values. If you select the Do not show this message again check box inside the warning message, then the Display information message when Web Service Testing Wizard finishes check box in the Options dialog box is automatically cleared. If you want to reactivate the reminder message, select this check box again.

Web Services Options
WS-I Validation tool location

   Check that Your WSDL Meets WS-I Standards

Before we start testing WS-I Validation we are going to prepare three different wsdl file sources to review all the aspects.

Validating WS-I by URL Location

To specify a WSDL from a URL source on a Web server, we are going to enter the URL address manually or click the Navigate button next to the URL box to open your default browser. navigate or enter the following address: http://www.soapclient.com/interop/SQLDataInterop.wsdl
WS-I Validation
WS-I Validation by url location.
View Results...

Validating WS-I by File Location

To specify a WSDL file, select File. Enter the file path manually or click Browse next to the File box to open the Browse for WSDL File dialog box. Browse to the required file. in the downloaded toolkit we the a demo file located in the samples folder. Select or type : [wsi-location]/samples/RetailerService.wsdl
WS-I Validation
WS-I Validation by object repository location.
View Results...

Validating WS-I by Object Repository Location

To specify a WSDL that defines a service for which a test object has already been created in one of the repositories associated with the current action (or component), select Repository, and then select the relevant test object. QuickTest locates the WSDL according to the location specified in the wsdl property of the WebService test object
WS-I Validation
WS-I Validation by file location.
View Results...

Report Options

Click the Report options down arrow and select the criteria for the assertion results to be included in the validation report. (Test assertions are used by the validation tool to analyze whether a Web service conforms to WS-I standards.)
Report all assertions. Reports the results of all assertions.
Report all assertions but passed assertions. Reports the results of all assertions except those that have a "passed" result.
Report only failed assertions. Reports the results of assertions that have a "failed" result only.

Validation

Click the Validate button to analyze the specified WSDL source and check that it conforms to WS-I standards. The validation is performed for each binding defined in the WSDL. This process might take some time. When the check is complete, the Validate WSDL dialog box expands to display the results of the validation check in the Validation reports area. This area lists the reports generated by the WS-I testing tool and indicates the status of each report.

   Hands-On: Handling a Single-Simple Return Value

Let's start practicing with a service that return one single value. navigate to www.webservicex.net and select the Value Manipulation/Unit convertor category. Select the Temperature Web service.

Since we are testing SOAP requests we are interested to know what is the WSDL location also we can see the Function name ( ConvertTemp ) and the Server Description Before we start with QuickTest Web-Services Wizard we want to understand, what we are going to do. So, we are going to use the Temperature service, with a single operation ConvertTemp the operation will receive 3 parameters :

  <s:element minOccurs="1" maxOccurs="1" name="Temperature" type="s:double" />
  <s:element minOccurs="1" maxOccurs="1" name="FromUnit" type="tns:TemperatureUnit" />
  <s:element minOccurs="1" maxOccurs="1" name="ToUnit" type="tns:TemperatureUnit" />

The 1st parameter Temperature of type double( number ) The 2nd parameter FromUnit of type TemperatureUnit The 3rd parameter ToUnit of type TemperatureUnit
TemperatureUnit is a string with the following values range: degreeCelsius, degreeFahrenheit, degreeRankine, degreeReaumur, kelvin

- <s:simpleType name="TemperatureUnit">
- <s:restriction base="s:string">
  <s:enumeration value="degreeCelsius" />
  <s:enumeration value="degreeFahrenheit" />
  <s:enumeration value="degreeRankine" />
  <s:enumeration value="degreeReaumur" />
  <s:enumeration value="kelvin" />

The web service returns 1 single argument of type double.

- <s:element name="ConvertTempResponse">
  <s:element minOccurs="1" maxOccurs="1" name="ConvertTempResult" type="s:double" />

We're moving to QuickTest; Opening the Web Services Wizard in the Specify WSDL for Scanning pane, we select the URL option and type the WSDL Location and then we click on the Next button.

In the Select Service and Operation pane we select the ConvertTemperature Service Name and ConvertTemperatureSoap Port Name, and the ConvertTemp available operation. and then we click on the Next button.

Finally, we uncheck the Add XML checkpoint... option, since we don't want to implement a checkpoint right now.

5.1 - ConvertTemperature generated code

so, what do we have now, after using the Web Service Wizard? lets say that we want to convert 50 Farenheit to Celsius ( 10 ) we have now to manuallly change the input values. the 1st will be 10...

Since that the WSDL file argument are defined, QuickTest "knows" what are the input options order and values should be.
Param1
Param2
Param3
5.1 Download
  • File Name: demo1.zip
  • File Size: 15.7KB
  • File Version: 1.0
Click here to download example 5.1 for QTP 10
   Hands-On: Handling a Single-Complex Return Value

The following Web Service is still a simple one, even that for those unfumiliar with XML and XPath Can be complexed. the following web service still returns a single string, but on more complex pattern. In fact, an Xml pattern.

Let's start by understanding the purpose by watching the wsdl file, and understand the involved arguments. navigate to http://www.webservicex.net Service Global Weather click on the Service Description link.

<s:element name="GetWeather">
:
:
<s:element name="GetCitiesByCountry">

The above definitions means that we have a service with to operations.

  1. GetWeather
  2. GetCitiesByCountry
like a function library with more than one public function in it.

<s:element name="GetWeather">

  <s:element minOccurs="0" maxOccurs="1" name="CityName" type="s:string" />
  <s:element minOccurs="0" maxOccurs="1" name="CountryName" type="s:string" />
<s:element name="GetWeatherResponse">
  <s:element minOccurs="0" maxOccurs="1" name="GetWeatherResult" type="s:string" />

The Operation GetWeather recieves two string arguments:
The 1st is a string represents a CityName and the 2nd is a string represents a CountryName. The operation returns a single string.

<s:element name="GetCitiesByCountry">

  <s:element minOccurs="0" maxOccurs="1" name="CountryName" type="s:string" />
<s:element name="GetCitiesByCountryResponse">
  <s:element minOccurs="0" maxOccurs="1" name="GetCitiesByCountryResult" type="s:string" />

The Operation GetCitiesByCountry recieves a single string argument:
A string represents a CountryName. This operation also returns a single string.

Hands On

First we are activating the Web Services Wizard  , or alternativelly from the menu Automation / Web Service Testing Wizard.. The Web Service Testing Wizard opens.

Step 1

in the Welcome to the Web Service Testing Wizard Screen  just click Next

Step 2

in the Specify WSDL for Scanning Screen  select the URL option, and paste the following WSDL location: http://www.webservicex.net/globalweather.asmx?wsdl, uncheck the Include security settings in the generated Web service test option, and click Next

Step 3

in the Select Service and Operations Screen Click on the button to add all Available Operations to Selected Operations list and then , click Next.

Step 4

in the Wizard Summary Screen  uncheck the add XML checkpoint after each relevant step option and then , click Finish.

Step 5

6.1 - Print web Services Results

Modify the generated code to print the results.


Step 6

6.2 - Handling return information - XmlUtil

Only after we understand, what is returned, we can now organize that information for later use. This article part will only demonstarte how to handle the returned information. later on, we'll see how to also test/check the information, understanding the SOAP response and more.

6.3 - Handling return information - XmlDom

The same as above, but implemented using the XmlDom object.

6.2 Download
  • File Name: simple2.zip
  • File Size: 16.5KB
  • File Version: 1.0
Click here to download example 6.2 and 6.3 for QTP 10