In-reply-to » Writing and running full e2e integration tests using Go and for Go CLI applications. Lookingo into one of:

@lyse@lyse.isobeef.org Yeah I actually use this technique a lot in GoNix for basically all the Applets. I think this makes it easier to test. The cmdtest package is kind of cool though really, it basically implements the same kind of test runner as you may (or may not) have seen in the Mercurial test suite. The test files in testdata are essentially text files that look a bit like youโ€™ve run something on the console and copied pasted them. This is brilliant for e2e cli integration testing ๐Ÿ‘Œ And yes it manages to run the test binary so that coverage can also be measured which is fantastic ๐Ÿ‘Œ โ€“ Of course this does not preclude you from writing unit tests for any other parts of your package/library that have a public facing API โ€“ But if your public facing API is just the CLI then this is a perfect fit ๐Ÿ‘Œ

โค‹ Read More