A Practical Guide to Testing Object-Oriented Software
We now want to discuss testing programs that use some of the standard infrastructures for distributed systems. Basic Client/Server Model
The client/server model in which multiple clients all have access to the server is the simplest model of distribution. The server is a single process and an indefinite number of client processes can request service from the server. This model has a single point of failure since all of the clients interact with the same server. This model gives a basic idea of a few of the testing issues for distributed systems, but a few systems raise issues that are more difficult than this model. Testing implications:
Standard Models of Distribution
The simple client/server model has been generalized to allow the single point of failure of the client/server model to be eliminated. Multiple servers can provide the same service and a client can select which server to use. The early implementations of these models were error prone even in the hands of highly qualified developers because of the primitive pipe and socket structures that had to be manipulated. With the advent of object-oriented techniques, models were developed that abstracted away the networking details and reduced the number of errors. We will not go back and talk about testing the more primitive implementations. We will remain at the object level and assume that a commercial infrastructure is available to hide the communication details. We will provide just a brief introduction to each of three standard models and then discuss how each supports or facilitates testing systems written using the model. Later, we will discuss the basic infrastructure for Internet applications. CORBA
The Common Object Request Broker Architecture (CORBA) has been developed by the Object Management Group (OMG) as a standard architecture for distributed object systems. The central element in this architecture is an object request broker (ORB) that one object uses to communicate with other objects in the system. The standard infrastructure provided by a CORBA-compliant system provides services that allow one object to find other objects based on objects being requested, location, or load. The infrastructure also provides services needed to connect two objects written in different languages or objects that are executing on different types of machines. A number of vendors provide products that form the infrastructure for this model. This "standard architecture" does not totally specify an implementation so the software provided by different vendors have competitive differences such as faster throughput and a smaller footprint. CORBA is sufficiently mature so that many of these products have experienced many releases and can be considered "trusted." The CORBA standard is based on the following set of assumptions:
CORBA has the advantage in terms of flexibility. We will focus on this technology in the following examples although the techniques can be applied to the other models with slight modifications. Testing implications:
DCOM
The Distributed Component Object Model (DCOM) is a standard developed and promoted by Microsoft. This infrastructure is freely distributed with the Windows operating system, thus making its cost a clear advantage. The DCOM "standard" is described in terms of standard interfaces containing specific methods rather than architectural generalities. Each standard interface provides a specific set of services. A single component may implement the services of several interfaces or several components may each implement the services of the same interface but in different ways. The DCOM infrastructure supports the initial connection between components but not as an ongoing part of the application. This reduces the layers through which messages must flow and increases the throughput. However, the standard is largely limited to Intel-compatible machines. This eliminates the need for any type of translation or interfacing services at a cost of the types of systems that can be included in the system. DCOM is a low-level technique that requires an understanding of low-level details and requires the developer to make a number of detailed decisions correctly. Some tools are emerging that automate some of the implementation process and reduce the number of errors. Testing implications:
RMI
The Remote Method Invocation (RMI) package in Java provides a simplified distributed environment that assumes that no matter what machines or what type of machines are connected, they will all be running a Java virtual machine. This homogeneous environment has a structure that is similar to CORBA but is simpler due to the less flexible assumptions. A registry object is provided and all objects participating in the distributed system must know which port the registry listens to for messages. The latest version of RMI uses the Internet Inter-Orb Protocol (IIOP) to allow RMI objects and CORBA objects to work together. But more about this in the following general model. Testing implications:
Comparisons and Implications
These three models emphasize the prominent role of interfaces in object-oriented systems in general and distributed systems in particular. Distributed objects advertise services by listing their interfaces with the naming service of the infrastructure. The implication is that functional tests can be organized by interfaces. In particular, in DCOM applications, many classes may implement the same interface and the reuse of the tests for a specific interface will be high. Distributed object systems are based on a relatively small number of standards. Each model that we have discussed has a more or less formal standard, at least to the extent of standard design patterns. Tests based on these standards have the potential to be reused many times on a single project and across projects in a development organization. |