π© Go testing with pizazz! π
Go testing is great however the output is hard to scan, it takes longer to find issues than it should and it is either too verbose, or gives no information at all. I personally wanted more.
You can install and use this quickly by running:
β go install github.com/tanema/og
β og --version
og
makes it easy to address a package, file, and single test. Less typing, and
easier targeting. For instance to target a single test with go test
you would
user:
go test -run TestTheTestName ./lib/...
To do this with og
you can simply type:
og TestTheTestName
Some of the many ways you can address tests are:
og
run all tests recursivelyog TestTheTestName TestTheOtherName
run tests by nameog ./lib/pack/object_test.go:20
run single test at line 20og ./object_test.go
run all tests in./object_test.go
og ./object.go
run all tests in./object_test.go
or the package if it doesnt existog ./lib/...
same as the og go test.
The whole point of this tool is do less typing and see pretty colors. So instead
of specifying what you want to see each time you run the command, you can define
~/.config/og.json
and define the flags in there. You can see an example here:
{
"display": "dots",
"split": false,
"hide_excerpts": false,
"hide_elapsed": false,
"threshold": 10s,
"no_cover": false
}