The Power of Go: Tests (Go 1.23 edition)

The Power of Go: Tests (Go 1.23 edition)

$44.95

What does it mean to program with confidence? How do you build self-testing software? What even is a test, anyway?

Welcome to the thrilling world of fuzzy mutants and spies, guerilla testing, mocks and crocks, design smells, mirage tests, deep abstractions, exploding pointers, sentinels and six-year-old astronauts, coverage ratchets and golden files, singletons and walking skeletons, canaries and smelly suites, flaky tests and concurrent callbacks, fakes, CRUD methods, infinite defects, brittle tests, wibbly-wobby timey-wimey stuff, adapters and ambassadors, tests that fail only at midnight, and gremlins that steal from the player during the hours of darkness.

You can also buy this book at a discount as part of the Complete Go Library.

Reviews

⭐⭐⭐⭐⭐ “A great read—it's a treasure trove of knowledge on not just testing, but software design in general.”
—Joanna Liana

⭐⭐⭐⭐⭐ “The writing style is engaging, friendly, informative, and snappy.”
—Kevin Cunningham

⭐⭐⭐⭐⭐ “John's books are so packed with information, I learn something new every time I re-read them.”
—Miloš Žižić

⭐⭐⭐⭐⭐ “Brilliant. I read it with genuine pleasure. Well written, clear, concise, and effective.”
—Giuseppe Maxia

⭐⭐⭐⭐⭐ “All John’s books are an insta-buy.”
—Eldon Alameda

⭐⭐⭐⭐⭐ “I really enjoyed this book. The humour makes learning Go a lot more fun.”
—Sean Burgoyne

⭐⭐⭐⭐⭐ “This book was AWESOME. It answered so many questions that I’ve had.”
—Andrew Culclasure

⭐⭐⭐⭐⭐ “The best introduction to mutation testing. John's writing style made me smirk, smile and vigorously nod my head as I was reading.”
—Manoj Kumar

About the book

Go’s built-in support for testing puts tests front and centre of any software project, from command-line tools to sophisticated backend servers and APIs. This book introduces you to all Go’s testing facilities, shows you how to use them to write tests for the trickiest things, and distils the collected wisdom of the Go community on best practices for testing Go programs. Crammed with hundreds of code examples, the book uses real tests and real problems to show you exactly what to do, step by step.

“If you get fired as a result of applying the advice in this book, then that’s probably for the best, all things considered. But if it happens, I’ll make it my personal mission to get you a job with a better company: one where people are rewarded, not punished, for producing software that actually works.”

You’ll learn how to use tests to design programs that solve user problems, how to build reliable codebases on solid foundations, and how tests can help you tackle horrible, bug-riddled legacy codebases and make them a nicer place to live. From choosing informative, behaviour-focused names for your tests to clever, powerful techniques for managing test dependencies like databases and concurrent servers, The Power of Go: Tests has everything you need to master the art of testing in Go.

What you’ll learn

By reading through this book and completing the exercises, you'll learn:

  • How to build practical, reliable, and delightful Go programs, guided by tests

  • All the latest facilities available in Go’s top-class testing libraries and tooling

  • Standard techniques like table tests, parallel tests, deep comparisons, and golden files

  • Randomised input generation and property-based testing

  • Usability testing and exploratory testing

  • Advanced techniques such as fuzzing and mutation testing, with detailed examples

  • How to use tests to support and streamline bug fixing, refactoring, and maintaining legacy code

  • Testing error handling, validation, sentinels, wrapped errors, and other sad-path behaviours

  • Testing the untestable: user interaction, databases, CLIs, and HTTP servers

  • How to test and refactor legacy systems with awkward dependencies

  • Testing concurrent and asychronous APIs

  • Why concurrency safety matters, and how to test for it

  • Writing scripted tests for command-line tools using the testscript language

  • How and when to use advanced techniques such as mocks, doubles, stubs, spies, fakes, and adapters

  • Brittle, feeble, and flaky tests, how to avoid them, and how to fix them

  • Time, and how to fake it for testing

  • How to design useful, informative, and challenging test cases

  • How tests can tell a story, and how to write that story in a clear, engaging, and readable way

  • Building a quality-focused culture in your organisation and giving productive code reviews

And with the help of this book, you’ll learn how to build the most complex projects from scratch, using a simple, reliable, and stress-free workflow that delivers robust software fast. Tests are not the goal, I like to remind my students: the goal is programming with confidence.

Table of Contents

What you get

Your digital download is a ZIP file containing the book in PDF and ePub format. These should be suitable for any ebook reader, Kindle, computer, phone, or tablet.

You can read a sample chapter in PDF format:

Updating to the latest edition

All my books come with free updates for life, so if you’ve bought a previous version of this book, here’s what you need to do to get the latest edition. Click the link in your original download email (make sure you save this, as it’s your key to future updates). You’ll see what looks like an error page saying your download link for the old edition has expired, but that’s okay: click the link in the text, and you’ll be sent a new download email for the current edition.

Add To Cart