Open-Sourcing Tester: Lightweight Go Test Utilities

Workfit loves Go

The Go Gopher was designed by Renee French.

At Workfit, we strive for building world-class software at a high iteration velocity. We heavily rely on open-source software; it allows us to build for scale while standing on the shoulders of giants. Our tech stack aligns with our culture and values, which foster an environment for code craftsmanship to thrive and a strong bias for action. We’re pleased to kick off our engineering blog posts with open-sourcing Tester: a lightweight test library that we built for Go; a small token of giving back to the open-source community and fellow Gophers.

Go is the programming language of choice for many of our microservices; it provides the greatest return on investment for our needs: security, correctness, simplicity, iteration velocity, scalability, and maintainability. Testing is an integral part of Go; the language provides robust and opinionated support for testing and benchmarking. However, developers who moved from languages like C#, Java, and Python miss the convenience of test utilities like assertions and data providers for data-driven tests. That’s why we started Tester: lightweight test utilities to use with Go’s testing package. Most tests follow the same pattern: set up, invoke the unit under test, assert, then clean up (if need be); said pattern encourages test code reuse and consistency. By using test utilities, you can spend more time thinking about test strategies and less time typing boilerplate code.

Features

  • Assertions that make tests easier to read, write, and debug
  • Streamlined data providers for data-driven testing (DDT)
  • Test hooks’ hygiene check
Click here to Read More