Making Executable Specifications Out of Our Features
Understand how to use the godog library for E2E testing, including generating REST clients and implementing feature steps.
We'll cover the following
To make a feature file an executable specification, we will use the godog
library, which is the official Cucumber library for Go. With this library, we can write a TestEndToEnd
function that will be executed using the go test
command.
We will also need clients for each of the REST APIs. Normally, E2E tests would involve interacting with some end user UI, but our little application has none to work with at the moment. The REST clients can be generated using the go-swagger tool, which can be installed along with the other tools we have used in this course by running the following command from the root of the code for this chapter:
Get hands-on with 1400+ tech skills courses.