Growing Object-Oriented Software, Guided By Tests (chapter 10)

Feb 13, 22

In this chapter, we begin building the “walking skeleton”.

In essence, we try to build the most minimal version of our end-to-end system to allow us to stress test our findings from the knowledge gathering state (chapter 9).

We use this stage to test out all of the assumptions we made previously, and we should be able to build and deploy the app to a production environment (and the build should fail to deploy if we have a failing test). It can be surprising how long this stage takes.

However, this is a really important part of the process, that sets up the direction of the project. We can think of this stage of the process as ‘iteration 0’, where we are setting up the infrastructure of the project.

The authors describe how they go about writing their first test.

As discussed in the previous chapter, they essentially break off the thinnest slice of the system and try to test this end to end.

Sidenote, but Java libraries have the funniest names - Swing, Smack and WindowLicker are mentioned here. LOL

We should try and write the test code as if everything already exists. The application itself can be a black box - The authors are using a polling system to check if certain behaviour has been completed.

It should be noted that these end-to-end tests can be flaky as we are reliant on polling at certain intervals. If there is any network component the test could get scuffed.

Unit tests on the other hand should never be flaky - you control the entire setup/test/teardown process.

Obviously in the beginning none of this will be passing.

This is where more research will be required - which libraries should we use for the test harness?

We should also avoid getting too tied to any external systems at this point - but we should use our best judgement. We have to decide where the boundaries of our system are.

Using state machines to describe how the app will function seems a great way to begin a project (once we have a good understanding of the domain).

We can use transitions in the state machine to guide the slices in our system.

Like we mentioned above - break off the smallest slice of the state machine that you can, and use this to build the ‘walking skeleton’