Behavior testing or integration testing is a good method of performing end-to-end black box testing. One popular framework for this type of testing is cucumber (https://cucumber.io/), which uses the Gherkin language to describe the steps to a test in English and then implement those steps in code. Go has a cucumber library as well (github.com/DATA-DOG/godog). This recipe will explore using godog package to write behavior tests.
Behavior testing using Go
Getting ready
Configure your environment according to these steps:
- Refer to the Getting ready section of the Mocking using the standard library
recipe of this chapter. - Run the go get github.com/DATA-DOG/godog command.
- Run the go get github.com/DATA-DOG/godog/cmd/godog command...