Summary
Web services should be tested at both the code level, with unit tests, and the messaging level, according Rami Jaamour, a product manager at testing company Parasoft. In an interview with Artima, Jaamour explains the difference between unit tests and message-level tests, and how Parasoft's SOATest 5.0 tool helps integrate the two.
Advertisement
Parasoft released SOATest 5.0, a new testing tool that helps test Web services. The most notable feature of SOATest is its ability to exercise a Web services system at the message-layer level, and generate a series of JUnit tests that capture the system's behavior. Developers can examine those assertions to ensure that the system functions as intended.
Because Web services extend traditional programming interfaces to XML-based messages, testing Web services is tricker than unit testing programming language interfaces, according Rami Jaamour, Parasoft's product manager for SOA testing tools.
In an interview with Artima, Jaamour noted that such message-level testing is hard, because testing messages needs to integrate with testing the implementations of those services. Message-level and code-level testing are sufficiently different to make that integration non-trivial:
SOA has resulted in some of the business process logic
migrating from application code to the message layer. Rather than business process, content routing and security policies being implemented within applications, they are implemented ... using descriptive technologies within orchestration engines, ESBs, and gateways.
This migration makes testing process scenarios at the message layer a necessity since that's where [the application's main functionality] now resides. Unit testing at the code level does not cover [messages] in scope.
Such message layer testing differs from traditional testing at the unit level. Unlike unit testing, message layer testing necessitates testing against the system at runtime. This brings about the need to have an emulated, or stubbed, environment...
[As well], in addition to validation against functional requirements, in message layer testing there is a need to validate certain non-functional requirements that are specific to XML and Web service technologies. That includes testing for compliance to practices that result in
interoperability and maintainability of SOA meta-data...
Additionally, you need to pay attention to negative testing to ensure that the services function reliably under unexpected conditions, such as bad data, missing data, and so forth, because you don't know who, when and how ... will be consuming your services, and have no control
over the data they will be sending to it.
Finally, message layer testing provides a great opportunity to perform load tests against the system early in the process. The same functional regression tests you are running against the runtime system should be leveraged for performance testing.
Jaamour noted in the interview that manually coding up tests to meet all those additional requirements is both laborious and error-prone. Instead, SOATest 5.0 can automatically generate JUnit test cases that exercise the system at the message-layer level:
Automation can go a long way in introducing these activities into your development process in a non-intrusive and effective manner... Automated activities can prevent
errors and problems from occurring later ... at which point they become more difficult and timely to resolve.