Testing checks that specific code behaves correctly. Quality assurance (QA) is the wider practice of preventing and catching defects across the whole development process. In Go, testing means go test, table-driven tests, benchmarks, fuzzing and the race detector. QA adds code review, static analysis, linters, vulnerability scanning, continuous integration and monitoring on top of those tests.
Tests are one tool inside a QA process, not a substitute for it.
| Aspect | Testing | Quality assurance |
|---|---|---|
| Question answered | Does this code do what I expect? | Is the whole process producing reliable software? |
| Scope | Functions, packages, services | Code, build, release, operations |
| Timing | While and after writing code | Before, during and after development |
| Go tools | go test, testing, fuzzing, -race | go vet, staticcheck, golangci-lint, govulncheck, CI |
| Result | Pass or fail | Fewer defects, consistent standards |
Testing finds problems in the code you wrote. QA also prevents problems by enforcing conventions and by checking things that tests do not, such as formatting, known vulnerable dependencies and API compatibility.
A unit test exercises one function in isolation. Table-driven tests with t.Run keep many cases readable.
Integration tests verify that components work together, for example a repository against a real database. Keep them separate from fast unit tests with a build tag or by checking testing.Short():
Run only fast tests with go test -short ./.... Containers started from the test (for example with Testcontainers) give each run a clean dependency.
The net/http/httptest package tests handlers in memory:
Benchmarks (go test -bench=. -benchmem) track speed and allocations, and fuzzing (go test -fuzz=FuzzName, since Go 1.18) searches for inputs that crash or break invariants. Use go test -race to expose data races. Together they cover performance and robustness that example-based tests miss.
QA is a pipeline of checks that run automatically on every change.
| Practice | Command or tool |
|---|---|
| Formatting | gofmt or go fmt ./... |
| Static checks | go vet ./... |
| Linting | staticcheck, golangci-lint run |
| Vulnerability scan | govulncheck ./... |
| Dependency hygiene | go mod tidy, go mod verify |
| Coverage report | go test -coverprofile=cover.out ./... |
| Code review | Pull requests with required approvals |
| Observability | Metrics, structured logs with log/slog, alerts |
govulncheck is especially useful because it reports only vulnerabilities in code paths your program actually calls, which keeps the noise low.
A minimal GitHub Actions or any CI job can chain the steps:
Fail the build on any non-empty gofmt -l output or non-zero exit. Run integration tests as a second stage so quick feedback is not delayed.
Coverage tells you which lines ran, not whether assertions are meaningful. A package with 90 percent coverage and no assertions is poorly tested. Prefer these signals instead:
No. Testing is an activity that verifies code. QA is the broader process that includes testing, reviews, static analysis, release checks and monitoring.
Run gofmt, go vet, go test -race ./... and govulncheck ./... in CI on every pull request. That already catches a large share of defects.
No. Aim for meaningful tests of important behaviour. Chasing 100 percent encourages low-value tests that assert nothing.
Hide the service behind a small interface, pass a fake in tests, and cover the real integration with a separate, slower test.
Go's testing tools verify behaviour, while QA wraps them in formatting, linting, vulnerability scanning, review and monitoring so quality is enforced consistently. Combine fast unit tests, a few integration tests, fuzzing and the race detector with a CI pipeline, and keep adding a regression test for every defect you fix.