Chapter 13.  Testing a Distributed Application

In the previous two chapters, we discussed threading in detail. Now that we have threading under our belts, it’s time to return to the idea of testing our distributed application. In this chapter, we’ll discuss the basics of building a testing framework, and walk through a set of minimal tests for the bank application.

When you think about the amount of code, and the number of independent pieces that must perform correctly in order for a distributed application to work, it’s very easy to feel a certain amount of despair. Consider that each computer running part of the application has at least four layers of independently written code: the BIOS, the operating system, the JVM, and the application. Remote method invocations are sent from one machine to another, forwarded by other computers and network devices. Persistence is achieved through the user of relational database management systems, which are themselves huge and complex pieces of code that run on independent servers.

The complexity involved is incredible. The number of subtle errors that can be made, by any of the developers involved, is incomprehensible. There is no way to be certain the piece of code you’ve written is solid in itself, much less that it behaves well as part of the larger system. In the face of all the potential errors, and the uncertainty that they produce, the best thing you can do is test your code. Test early, test often, and always remember that until ...

Get Java RMI now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.