chapter twenty one
21 Stagecraft patterns for interacting with external resources
This chapter covers
- Avoiding unnecessary initializations of external resources
- Enabling the parallel execution of scenarios that depend on costly external resources
- Simplifying automation code by encapsulating all operations that interact with the file system
- Some common approaches to testing behaviors that depend on asynchronous operations
The behavior of our systems frequently depends on external components that are costly to provision, slow to initialize, and complicated to interact with. Nonetheless, we still want to receive fast feedback from running our tests, so we need techniques that can help minimize any degradation to test execution that these external components introduce.
In theatre, the technical aspects of a production are collectively known as Stagecraft. The patterns described in this chapter provide low-level, behind-the-scene solutions to several technical challenges related to effective test automation: