Intermediate

Working with Go Modules and Testing

Manage real dependencies with go.mod, then write table-driven tests, benchmarks, and fuzz tests that actually catch bugs.

~5h
0 / 5 steps
🚀
Intro

Before We Start

Prerequisites: Build a REST API in Go, or an existing Go module with at least one function to test.

Version note: verified against current docs as of July 2026, targeting the common Go 1.25/1.26 feature set.

go test needs no separate framework, runner, or config file — any function named TestXxx(t *testing.T) in a _test.go file is discovered and run automatically. This project adds a real dependency to a module, then builds out unit tests, table-driven tests, a benchmark, and a fuzz test against the items API from the previous project.

🔨

Add and manage a real dependency

🔨

Write table-driven tests

🎯
Secret Mission

Secret Mission: Get coverage above 80%

🧹
Wrap Up

Before You Go

Pro

Test what you just learned

Self-testing is one of the best ways to retain new skills. Unlock project quizzes to check your understanding.

Log in to unlock