Refactoring in Go
We have explored concepts and techniques for tests across the entire testing pyramid. We have applied these concepts while building our main project of study, the BookSwap
application. This web application is currently verified by the following:
- Unit tests implemented using the Go standard library
- Integration tests implemented using
httptest
- End-to-end tests implemented using
godog
To demonstrate these techniques in a realistic example, we have extended the functionality of the BookSwap
application with a variety of components. In Chapter 6, End-To-End Testing the BookSwap Web Application, we extended the project by adding the ability to run it in Docker and use a PostgreSQL database to save its data.
All of these changes have added complexity to our BookSwap
application, which now relies on the following:
- Two libraries for database migration and operations –
golang-migrate
andgorm
- Three different types of files –...