During the past few years we've seen an exponential rise in Web-based
applications, and we're currently beginning a transition to a
service-oriented Web. Web services technology enables several
functional elements (services) to communicate with each other. The
key to the success of this technology is the ability to exchange
messages between services implemented on disparate platforms.
We've embraced SOAP as the protocol for message exchange, and
fortunately, it has received a good response from the key players in
this technology. Loose coupling is a great feature of Web services
technology, but at the cost of stringent constraints on the validity
of the messages exchanged.
With Web services, the underlying idea of serving client requests
isn't very different from the technologies we've grown accustomed to
in the past few years. Based on experience with Web-based
applications, simulated clients and servers are ideal for testing
client and server behavior. As the technology
receives the anticipated acceptance, performance testing under
varying loads will be another requirement. Parasoft has addressed
these specific needs with SOAPtest, a collection of tools that can be
assembled to test certain scenarios and record the results.
Installation
The installation went very smoothly. It's available with and without
the JRE; I used the one with the JRE.
Features
After installation, I browsed through the documentation provided with
the product and was overwhelmed by the variety of functionality. The
documentation highlights specific functionality while describing the
general features.
SOAP Client and SOAP Server
The core feature of SOAPtest is the ability to simulate SOAP-client
and SOAP-server functionality. In Web application environments, the
Web browser (client) tested the server-side applications. With Web
services technologies, we'll have to rely on custom-built client
applications. In most cases these client applications will have to be
recompiled to test different scenarios. A tool that can simulate
client behavior will be very valuable.
The SOAP Client tool makes simulating the SOAP client functionality
easy. The tool provides many options for testing a variety of
scenarios. It offers a choice between "RPC" and "Document" for the
body type of the SOAP message. The message can be created in three
different ways: Literal XML, Scripted XML, or Form Input. If WSDL can
be provided, most of the options are prefilled.
I used this tool to create a test request to the famous "Stock Quote
Web Service" deployed on my machine. I used the Form Input method to
create the request message (see Figure 1).
Once all the required fields on the screen were set, I could run the
simulated client by just clicking a button. I could send different
requests by changing the options/data on the screen. At the same
time, I could test whether the server could handle incorrect input
data, incorrect method names, and so on. The response message, with
the fault element, could be examined in case of an error.
The ability to chain the output to certain other tools is a really
cool feature. The SOAP Client tool allows examination of the
following types of data: the XML request data, deserialized response,
and HTTP traffic data. Later we'll look at the feature used for
chaining tools to view the data generated during a test.
SOAPtest lets us simulate the SOAP server; the documentation explains
this feature in the "Deploying Web Services" section. Also, a tool is
provided to automatically create the server stubs from the WSDL file;
this tool can be used to emulate critical functionality that cannot
be made available for testing.
In addition to the basic functionality of SOAP client and SOAP server
emulation, SOAPtest has a myriad of other tools that can be of great
help in performing the tests. As mentioned earlier, the available
tools can be chained so that output from one tool is piped to one or
more other tools.
Browser
The Browser tool can be used to display the data exchanged (e.g., XML
request message, deserialized response, etc.) in a new browser
window. I tried using the Browser tool to display the XML request
message for the "Stock Quote Service" test. I just added the Browser
tool as an output for the XML request of the SOAP Client tool and it
allowed me to select from available browsers or add my own.
File Writer
The File Writer tool can be used to write out data. I also used it to
write out all the HTTP traffic in my earlier test. (Writing out the
HTTP data is another neat feature of the SOAP Client tool. This is
helpful because you can examine the request and response data from
the transport layer.)
Check Well-Formedness/XML Validator
The Check Well-Formedness tool and XML Validator tool can be used to
validate the XML message received as a response from a server.
Rule Enforcer
The Rule Enforcer tool allows you to check for certain patterns in
the response message by creating custom rules. This tool has a
companion tool, the CodeWizard, which lets you create the custom
rules graphically. There is separate documentation titled "RuleWizard
Documentation" for using this feature. At first look, it seems a bit
involved, but I think this tool could be very useful to test
occurrences of certain patterns in the response message. Besides, all
the tests can be saved and then later executed when there's a
change/update in the functionality of the Web service.
Diff
The Diff tool lets you compare the outputs. The output or response
from a server can be compared to preset data in a file or a certain
specific text data. Both the text data and the file name can be
supplied to the tool. The output data, which is used in creating
regression controls, can be compared in three modes: Text, Binary,
and XML. Using these we can easily determine if the functionality of
the server changes. I used this to verify the address information
returned by a sample "GetAddress" Web service. If the XML mode of
comparison is used, the results indicate the XPath location of the
element that was modified.
Method
Another interesting feature is the Method tool, which lets you create
your own application-specific tests - for example, checking database
updates. The product supports coding in Java, JavaScript, and Python.
The documentation provides instructions for configuring the Method
tool.
Additional Functionality
SOAPtest is designed with extensibility in mind and has features to
use external tools within the test scenario. The documentation says
that any third-party tool can be integrated into a test scenario.
There are many other support tools, such as the XML Cleanup, XSLT,
etc. These can all be chained to process the test results or to save
them.
Another important feature is load testing, which lets you create a
profile with the desired tests to be performed. The profile can then
be tested in different scenarios with simultaneous/staggered users.
You can easily run a simple load test that shows the results in a
tabular report giving the option to select/deselect the columns in
the report.
Conclusion
Parasoft seems to have given serious consideration to the experience
of testing Web-based applications. SOAPtest provides almost all the
features found on the wish lists of programmers and QA professionals.
I recommend this product to software developers and QA professionals
who want to more easily and efficiently verify the functionality and
scalability of their Web services throughout the development life
cycle.
About the Author
Prasad Joshi works as a senior developer for Syntel, Inc. He has four
years of experience in designing and implementing Web-based
applications using Java and XML technologies. Previously he worked on
Microsoft technologies such as ASP and Visual Basic.
prasadvjoshi@hotmail.com
All Rights Reserved
Copyright © 2004 SYS-CON Media, Inc.
E-mail:
info@sys-con.com