~/talk

Testing in Go: 101

Talkat Conf42 Golang 2022 · 2022-03-29..03-30· [testing, go]
linkedin:fdaines
slides:none on file

Covers how to write real Go tests using the built-in go test tool and testing package, including concrete examples: table-driven tests for dozens of cases, example functions that appear on godoc, and running tests from the CLI. Shows using testify/assert for Equal, ElementsMatch and Contains and testify/mock to return values conditionally (once, nth call) and fail on unexpected calls. Recommends placing tests in package_test and offers a BDD path with ginkgo+gomega.

AI-written summary · about

  1. 0:00Conference intro
  2. 1:13Why test apps
  3. 3:00Automated testing benefits
  4. 5:48Convincing stakeholders
  5. 9:42Testing pyramid and trophy
  6. 12:09Go testing tools
  7. 14:01First unit test
  8. 16:31Running and interpreting test results
  9. 20:04Table driven tests
  10. 22:53Table tests in Go
  11. 31:30Tests as docs
  12. 33:56Example tests in Go
  13. 36:26Test assertions
  14. 38:36Testify assertions
  15. 45:17Test doubles explained
  16. 56:02Stubs in Go
  17. 1:07:32Mocking with testify
  18. 1:15:13Test file locations
  19. 1:24:07Behavior driven development in Go
  20. 1:26:38BDD with Ginkgo
  21. 1:30:31Further learning
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.