-
Test files end with _test.go
-
Use Log to print
Log formats its arguments using default formatting, analogous to Println, and records the text in the error log. For tests, the text will be printed only if the test fails or the -test.v flag is set.
For benchmarks, the text is always printed to avoid having performance depend on the value of the -test.v flag.
-
Useful:
https://www.youtube.com/watch?v=ndmB0bj7eyw Testing Techniques
https://www.youtube.com/watch?v=S1O0XI0scOM&t=264s Advanced Testing in Go -
Os.stdout testing: https://stackoverflow.com/questions/69691554/go-test-terminal-output