Over the last few years I’ve had the opportunity to work on several Service Oriented Architecture (SOA) applications. I learned that writing integration tests for such applications is difficult, but important. The challenge lies in the fact that most SOA applications use testing approaches that are well suited for monolithic applications, but these approaches are not always suited for testing SOA applications. It is important because without integration tests it is far too easy for subtle bugs to creep into your code base.
What is SOA?
Service Oriented Architecture might be best understood by first understanding monolithic applications. Your typical long-lived Rails application tends to be a monolithic application. According to Martin Fowler, monolith applications:
While there might not be a universally accepted definition of SOA, applications that adhere to this approach exhibit some common characteristics. SOA is a style of architecting applications where the underlying structure supports communication between a collection of loosely coupled services over well-defined interfaces.
An example might help clarify:
In this example, there are two applications that comprise the SOA, the home application and the client application. home has a database and exposes a RESTful interface. The client does not have a database and communicates with home via HTTP. For example, if the client wants a list of all the users, it has to issue a HTTP request to the /users resource of the home application, home queries its database for all the users, and home responds to the client with a JSON respresentation of all the users.