Summary
In this chapter, we revisited our understanding and approach to covering edge cases of input variables. We began our discussion with the concept of code robustness, focusing on writing code that can handle unexpected inputs and errors. Once code robustness becomes part of our mindset, we start to understand the edge cases of our code. However, it can be very difficult to manually implement tests to cover all these values.
Two testing techniques leverage input generation to make this task easier: fuzz testing and property-based testing. Both of these techniques can be implemented with Go’s testing library, allowing us to easily leverage the benefits of these techniques to verify a broad range of edge cases to our components at any level. Finally, we looked at an applied example of how to use fuzz testing together with the BookSwap
application’s user creation flow, ensuring that it is stable for generated values.
In Chapter 11, Working with Generics, we will...