Outside-in TDD

The outside-in TDD methodology tries to boost the communicative nature of object-oriented programming, stressing the messages between collaborating objects and paying attention to the design of the system.

To do this, it starts from the outside, creating an acceptance test that describes what is about to be developed, and establishing a double cycle in which we alternate between the acceptance and unitary levels. In the unitary level we design the collaboration between objects, deciding the responsibility attribution in each phase of the iteration. For this purpose test doubles are used, mocks, setting certain expectations for them.

The most renowned author about this approach is Sandro Mancuso, who introduces it in several publications and conferences1.

Outside-in TDD doesn’t contradict the classic approach, but introduces a methodology that’s more applicable to real software development and provides it with context, emphasizing the design necessities.

On the other hand, it’s possible to perform an outside-in following the classic rules, seeking design during the refactoring phases. It’s no usual to find examples of this. One of them is this one from Sandro Mancuso himself with the Rover kata2, although it’s not a comprehensive application.