This is the code repository for Test-Driven Development in Go, published by Packt.
A practical guide to writing idiomatic and efficient Go tests through real-world examples
Experienced developers understand the importance of designing a comprehensive testing strategy to ensure efficient shipping and maintaining services in production. This book shows you how to utilize test-driven development (TDD), a widely adopted industry practice, for testing your Go apps at different levels. You’ll also explore challenges faced in testing concurrent code, and learn how to leverage generics and write fuzz tests.
This book covers the following exciting features:
- Create practical Go unit tests using mocks and assertions with Testify
- Build table-driven test suites for HTTP web applications
- Write BDD-style tests using the Ginkgo testing framework
- Use the Godog testing framework to reliably test web applications
- Verify microservices architecture using Pact contract testing
- Develop tests that cover edge cases using property testing and fuzzing
If you feel this book is for you, get your copy today!
All of the code is organized into folders. For example, Chapter02.
The code will look like the following:
func(e *Engine) Add(x, y float64) float64{
return x + y
}
Following is what you need for this book: If you are an intermediate-level developer or software testing professional who knows Go fundamentals and is looking to deliver projects with Go, then this book is for you. Knowledge of Go syntax, structs, functions, and interfaces will help you get the most out of this book.
With the following software and hardware list you can run all code files present in the book (Chapter 1-11).
Chapter | Software required | OS required |
---|---|---|
1-11 | Go 1.19 | Windows, Mac OS X, and Linux (Any) |
6-11 | PostgreSQL 15 | Windows, Mac OS X, and Linux (Any) |
6-11 | Docker Desktop 4.17 | Windows, Mac OS X, and Linux (Any) |
(optional) | Postman 10 | Windows, Mac OS X, and Linux (Any) |
For instructions on how to run code locally from Chapter01 to Chapter03, please refer to RUN_CALCULATOR_LOCALLY.md
For instructions on how to run code locally from Chapter04 onwards, please refer to RUN_BOOKSWAP_LOCALLY.md
We also provide a PDF file that has color images of the screenshots/diagrams used in this book. Click here to download it.
Adelina Simion is a technology evangelist at Form3. She is a polyglot engineer and developer relations professional, with a decade of technical experience at multiple start-ups in London. She started her career as a Java backend engineer, converted later to Go, and then transitioned to a full-time developer relations role. She has published multiple online courses about Go on the LinkedIn Learning platform, helping thousands of developers upskill with Go. She has a passion for public speaking, having presented on cloud architectures at major European conferences. Adelina holds an M.Sc. in mathematical modeling and computing.
If you have already purchased a print or Kindle version of this book, you can get a DRM-free PDF version at no cost.
Simply click on the link to claim your free PDF.
https://packt.link/free-ebook/9781803247878