Open trustmaster opened 7 years ago
After studying the existing repos in the company, I'm gonna answer myself with what I found as the most common or most trending pattern:
High-level functional tests are using Godog.
Lower level code is covered with traditional unit tests using testing and testify.assert
I would like to open a discussion on recommended approaches to testing Golang projects at HelloFresh, split into sections below.
Testing framework
I've noticed the following testing combinations in some of the existing Go projects at HelloFresh:
:trollface:
Some classic tests with assertion.
I suppose this was supposed to be somewhat BDD, with some traditional unit tests and
testify
for assertions. But I haven't understood how the responsibilities between godog-generated tests and other test files are separated in that project.Could someone shed more light on the subject and also why you prefer Godog over Ginkgo and GoConvey?
Mocks
Do you prefer mocking external services at
interface
level or via HTTP mocks? What do you use for that?HTTP requests
Do you use any specific approach to tests HTTP route handlers?
If you have more feedback to share, go ahead. I'll combine it into a wiki page later on.