when relevant content is
added and updated.
In a previous posting, we examined the definition and basic functionality of a web service. Now let’s discuss the process behind testing web services. In order to perform any effective automated functional testing, two components are absolutely essential: good test data, and an adequate test tool.
Based on what we have already learned, the Data Requirements for testing web services should be fairly self-evident:
- The location of the WSDL file. This takes the form of a web URL, or the UNC path to a stored file on the network.
- The location of the web service itself, in the form of a URL.
- One or more valid SOAP requests in XML format. A SOAP request is used to exercise the operations presented by the web service.
- Identification of which data elements contain required values, and what those values are.
- Specification of the sequence in which operations must be called, if required.
The specifications which developers use to create the web service should contain all of this information, at least in the form of a template or simple unit test.
A good web service test tool allows us to easily manipulate the request data, submit the request to the web service, and then analyze the response. The Test Tool Requirements are summarized here:
- Allow import of the WSDL file to define the structure of the service.
- Expose the operations offered by the web service.
- Allow import of the XML SOAP request.
- Provide editing of XML structures (e.g., the imported SOAP request) for test data input.
- Support parameterization of element values for data-driven tests.
- Provide the ability to submit the SOAP request using a protocol (e.g., HTTP) supported by the web service.
- Include a method for capturing and storing the response.
- Support the creation of baseline checkpoints for regression testing. This allows the tool to verify a runtime response against a previously stored, known good response.
Regardless of the test tool selected, the process for creating and executing functional tests of web services is pretty much the same:
1. Import the web service WSDL file into the test tool
2. The test tool scans and parses the WSDL file to expose the operations
3. Choose the operation to call based on requirements of the test case
4. Provide input data using the test tool:
- Import the SOAP request into the test tool, and/or
- Edit the XML request generated by the test tool or SOAP import
5. Parameterize the input data
6. Execute the operation call(s):
- 1st Iteration: store response as baseline
- 2nd+ Iterations: capture response from web service for verification
7. Verify captured response against stored baseline (expected) response:
- Structure – text check of XML tags
- Content – XML checkpoint