Golang testing at Stream

Click for: original source

Federico Ruggi deep dive into testing of golang apps at Stream. Stream’s API is used in production by more than 500 companies and 200 million end users. While they like to move fast, they definitely don’t like to break things. Stream is an API for building activity feeds that enables your development team to build personalized activity feeds this week.

Testing is a core part of their development process. Not a single line of code is deployed to a live system before it’s properly tested and peer reviewed. Their workflow looks like this:

  • Implement the new feature with TDD using Golang testing package, alongside some goodies from stretchr/testify
  • Write integration tests and acceptance tests with onsi/ginkgo and our own soon-to-be-released bdd library
  • Wait for the green light from Travis CI
  • Check test coverage on Codecov
  • Ship the new feature to staging

Article then explain each bit of their workflow with code examples and any decision reasoning.

Writing tests with Go is generally a fun experience, thanks to the simplicity of the language: the standard library offers a streamlined testing environment, and the vibrant Gophers community came up with nice tools built on top of it. Good read!

[Read More]

Tags programming golang tdd