Date Posted: October 4, 2007
What is IBM Server-Side Testing Scaffold for Java?
Currently, Java™ server-side testing (including IBM® WebSphere® Process Server testing) is so non-agile that even a small test logic modification necessitates full content rebuilding and redeployment between the server and client. IBM Server-Side Testing Scaffold for Java is designed to solve this problem.
This scaffold implements a generalized proxy strategy that automatically generates corresponding proxies for every test target object. These proxies are on the Java client side; the test target objects are on the Java server side. These proxies' APIs are same as the target objects' APIs. Because the use of these two kinds of proxies is same, the learning curve is practically non-existent. In this implementation, these proxies are referred to as testing proxies.
Testing proxies can work well with the existing Java objects on the Java client side. These Java objects can accept testing proxies as parameters, and nested testing proxies can also accept other Java objects as parameters (as long as these Java objects are serializable). With multiple combinations, one can then use testing proxies and other Java objects together to easily prepare test logic.
When specific test logic on the client side is exercised, testing proxies deliver their corresponding APIs, invoking a testing agent on the Java server side. The testing agent invokes the proper execution at the target object and returns the result. Depending on the result type, the scaffold might directly return the result (as in Java.lang.String); it might generate a new testing proxy (such as an interface) and return it; or it might throw an exception (such as when a testing agent is calling a target object API). The communication between testing proxies and agent is handled through HTTP protocols.
IBM Server-Side Testing Scaffold for Java includes three sample embedded proxies: Service Component Architecture (SCA) proxy, Stateless Session Bean proxy, and MBean proxy. The SCA proxy is useful for WebSphere Process Server/Enterprise Sevice Bus server-side testing, which is built on the core concept of SCA. The Stateless Session Bean proxy can be used for testing stateless session beans, and, similarly, the MBean proxy can be used when testing MBean. IBM Server-Side Testing Scaffold for Java can be adapted for generating new proxy definitions as well; good example proxies are included. After a new proxy is created, the scaffold allows it to work well with all existing proxies: In other words, the new proxy can use other proxies as parameters or return new proxies as returned values. In fact, many testing proxy APIs return new proxies if needed. This step is automatic, so the invoker might not realize it has occurred.
IBM Server-Side Testing Scaffold for Java should be thought of as a testing scaffold rather than a framework. As a scaffold, it is designed in a general sense to work with any kind of testing framework. For example, it can be used in existing testing frameworks such as JUnit, Java Testing System, etc. It keeps its pure Java API feature and is independent of the testing framework.
How does it work?
IBM Server-Side Testing Scaffold for Java is a Dependency Injection reference implementation whose most distinguishing feature is that it moves test logic from Java server side to Java client side. This capability enables Java server-side testing to be performed on the client side. The scaffold imports a proxy layer in order to separate test logic from actual test execution.
A simple example is shown in the following code:
List list = (List) objfact.create(ArrayList.class);
// on Java server side,
'new ArrayList()' will occur
list.add("hello");
In the above code, list is the proxy that can be invoked directly on the Java client side; add("hello") is delivered to the Java server side for execution through the HTTP protocol by the proxy list.
About the technology author(s)
JunJie Nan is a software enginer at the IBM China Software Development Lab. Mr. Nan joined IBM in 2003 and has worked with IBM WebSphere Process Server for over three years.
