Unit Testing Essentials
In the previous chapter, we learned all about the iterative process of writing tests alongside code using TDD, as well as how it fits into the Agile project methodology. We covered the red, green, refactor approach, which requires frequent switching between source code and test code.
When first starting with TDD, following a prescribed process for writing code may seem like an artificial way of working, but it soon becomes second nature with practice. In this chapter, we will learn all the Go fundamentals required to begin putting everything else we have learned to use. We will begin to write unit tests with Go’s testing
package, focusing on the test writing syntax and process. This chapter will allow us to get hands-on experience with all the concepts we have explored so far.
As we saw from the testing pyramid in Chapter 1, Getting to Grips with Test-Driven Development, unit tests are the most numerous. They are used to verify the functionality...