Julia comes with excellent tools for building automated unit tests. When the programmer follows good design patterns and best practices, the software is likely going to be composed of many small functions that can be tested individually.
Unfortunately, certain test cases are more difficult to handle. They usually involve testing components that have specific dependencies that are awkward to be included in automated tests. Common issues include the following:
- Performance: The dependency may be a time-consuming process.
- Cost: The dependency may incur a financial cost every time it is invoked.
- Randomness: The dependency may produce a different result every time it is invoked.
Stubbing/Mocking is a common strategy to address these issues. In this section, we will look into how to apply stubs and mocks while testing Julia code.