Table Tests, Subtests & Helpers | Go Tutorial #29
3views
0016:10
T
Taught by Celeste AI - AI Coding Coach
View on YouTubeDescription
Learn unit testing in Go! Go's built-in testing package makes it easy to write reliable, maintainable tests without any external
dependencies.
In this lesson, we build tests from scratch covering four key patterns every Go developer should know.
What you'll learn:
- Writing test functions with func TestX(t *testing.T)
- Test file naming convention (_test.go)
- Running tests with go test -v
- Table-driven tests - the Go community standard pattern
- Subtests with t.Run() for organized, named test cases
- Running specific tests with the -run flag
- Test helpers with t.Helper() for clean error reporting
- TestMain for setup/teardown across test suites
- t.Skip() for conditionally skipping tests
Source code: https://github.com/GoCelesteAI/go_testing
Timestamps:
0:00 - Introduction
0:30 - Test Basics
3:45 - Table-Driven Tests
6:35 - Subtests with t.Run
10:10 - Test Helpers, TestMain & t.Skip
14:00 - Recap
14:30 - Up Next
Testing is a first-class citizen in Go - no extra frameworks needed!
Subscribe for more Go tutorials!
#golang #go #programming #tutorial #testing #unittesting #tdd #tabletest
---
Tags
Back to tutorialsOpen in YouTube
Duration
16:10
Published
February 5, 2026
Added to Codegiz
March 15, 2026