Static analysis tool to detect assertion-free tests in golang projects
To write useful unit tests, developers must provide assertions to validate behaviour is correct. However, developers can sometimes forget to add such assertions, or worse, they might write assertion-free tests in order to obtain good code coverage.
This simple static-analysis tool aims to flag up any tests that do not call testing.Fail
at some point in their callgraph.
The tool does nothing to help you write 'good' unit tests however...
Run :
go get github.com/the4thamigo_uk/noassert
This will build and install the binary in the GOROOT/bin folder.
To use simply specify a package path e.g. :
noassert "github.com/the4thamigo-uk/noassert/testlib"
Improvements will be made to support additional command line arguments.