Lesson 11 of 60
GoTesting in Go: The `testing` Package
20 minutes
Course progress18%
Testing in Go: The testing Package
Testing is built into Go. This lesson explains how to write unit tests, run them, and use table-driven patterns.
Unit testing
Create a file ending in _test.go and use the testing package.
package main
import "testing"
func {
got := add(, )
want :=
got != want {
t.Fatalf(, got, want)
}
}