Module 11 of 12

Testing, Tooling & Profiling

Lessons

About This Module

Working code is not the same as trustworthy code. Go builds testing and performance measurement into the toolchain, so checking that your program is correct and fast takes only a few extra commands rather than a separate framework.

This module starts with unit tests using the standard go test command, then covers table-driven tests, the idiomatic way to check many cases at once. It continues with benchmarks for measuring how fast code runs, and finishes with profiling with pprof for finding where a program spends its time and memory.

Watch the lessons in order and add tests and a benchmark to one of your earlier programs, then continue on to Building & Shipping.

Lessons

4 videos
01

Unit Testing with Golang

Writing and running unit tests in Go with the built-in testing support.

02

Go Table-Driven Tests: Master Efficient Testing

The table-driven style of testing, where one test function checks many cases.

03

Go (Golang) Benchmark Tutorial

Measuring how fast your code runs by writing benchmarks.

04

Go Profiling Tutorial: Find Performance Bottlenecks with pprof

Using pprof to profile a Go program and track down performance bottlenecks.