-
Book Overview & Buying
-
Table Of Contents
Building Modern CLI Applications in Go
By :
So far, within our command-line application journey, we’ve built tests and mocked the service output. The benefit of using containers, besides having a consistent and isolated environment for tests to run on any host machine, is that you can use them for running integration tests that provide more reliable test coverage for your application.
We created a new integration_test.go file to handle the configuration and execution of integration tests, but we don’t want it to run with all the other tests. To specify its uniqueness, let’s tag it with int, short for integration. At the top of the file, we add the following build tag:
//go:build int && pro
We include the pro build tag because we are testing all the available features.
First, let’s write the ConfigureTest() function to prepare for our integration tests:
func ConfigureTest() {
...