Test Go code with tables, fuzzing and benchmarks
8 steps · about 4 h 10 min · Intermediate
- Write focused I/O test cases (reference, Go package documentation, 25 min)
Purpose-built readers and writers establish observable boundary behaviour.
- Test file-system invariants (reference, Go package documentation, 35 min)
A test file system creates boundary cases without machine-specific fixtures.
- Understand how the Go test command runs packages (reference, Go package documentation, 40 min)
The command contract explains selection, caching and execution of test binaries.
- Keep tests at the package boundary (guide, Go documentation, 20 min)
Understanding packages prevents tests from depending on accidental working-directory state.
- Run tests with diagnostic flags (reference, Go command documentation, 30 min)
Race, count and timeout settings make concurrency failures easier to expose.
- Use coverage to find untested behaviour (reference, Go command documentation, 30 min)
Coverage points to missing paths without becoming the quality goal itself.
- Check properties across generated values (reference, Go package documentation, 30 min)
Generated values make invariant failures easy to reproduce from a small testing API.
- Profile benchmarked code (reference, Go package documentation, 40 min)
Benchmarks and profiles connect a performance claim to measured work.