liveBook · Manning

Inter-system communication

As explained in Unit Testing Principles, Practices, and Patterns

Communication between an application and an external system across an application boundary.

Inter-system communication occurs when an application talks to another application across its boundary. Because that communication shapes the system’s externally visible contract, its messages and interaction pattern must remain backward compatible even as internal code changes. section 5.3

Separate communications by whether they cross the application boundary:

  • Intra-system communication connects classes within the application. It is usually an implementation detail, so tests that verify these collaborations become coupled to refactoring-sensitive structure. section 5.3
  • Inter-system communication connects the application to external applications. It is observable behavior and can legitimately be verified when its side effects are visible externally. section 5.5
  • Treat out-of-process dependencies with care: an external system whose effects cannot be observed externally is still an implementation detail and need not be mocked. section 5.4

Verifying an external receipt

After a successful purchase, CustomerController sends a receipt through an email gateway. A resilient test checks the purchase result and verifies that the gateway received the customer address, product name, and quantity once. By contrast, verifying Customer’s internal inventory collaboration couples the test to implementation details. section 5.3

Figure 5.11. There are two types of communications: intra-system (between classes inside the application) and inter-system (between applications).

Use the communication boundary diagram to distinguish collaborations inside an application from interactions between applications. section 5.3

How Unit Testing Principles, Practices, and Patterns covers it

How deep it goes
Defines the boundary distinction, explains its contract implications, and applies it to purchase and mocking examples.
Examples
Uses an email gateway after a purchase and contrasts it with an internal inventory collaboration.
What you can do after
Diagnose/debug with it by deciding which communications belong in behavior-focused tests and which indicate fragile mock coupling.
How it connects
Connects inter-system communication with observable behavior, intra-system communication, mocks, test fragility, and hexagonal architecture.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Unit Testing Principles, Practices, and Patterns. The section links point to the parts of the book it draws on.