Go Testing
Jump to navigation
Jump to search
External
Internal
Overview
Go comes with a lightweight test framework that includes the go test
command and the testing
package. The tests live in *_test.go
files, located in the package directory.
Packages
Test Types in Go
Unit Tests
Integration Tests
System Tests
Integration Tests
System Tests
Benchmarks
Process this: https://pkg.go.dev/testing#hdr-Benchmarks.
Fuzzing
Process this: https://pkg.go.dev/testing#hdr-Fuzzing.
Skipping
Process this: https://pkg.go.dev/testing#hdr-Skipping.
Subtests and Sub-benchmarks
Process this: https://pkg.go.dev/testing#hdr-Subtests_and_Sub_benchmarks.
Main
Process this: https://pkg.go.dev/testing#hdr-Main.
Mocks
Mock support: github.com/golang/mock/mockgen
TO DO
- Integrate see external test packages.
- Testing idiom "Introducing Go" page 96.
- Investigate gotest.tools module.
- Running go test immediately after cloning should succeed without any configuration or any running database. If a database is required, those are integration tests.
- https://about.sourcegraph.com/blog/go/advanced-testing-in-go