There are numerous guides, talks and discussions on writing idiomatic go code, however, clear guidelines on writing quality unit tests in go are sparse. In this talk, we will show you best-practices from popular-open source projects for writing clean, extendable and idiomatic test code.
There are numerous guides, talks and discussions on writing idiomatic go code, however, clear guidelines on writing quality unit tests in go are sparse. Should you use a test framework or rely on native go testing package? Should you hand-write your mocks? When should you use data-driven tests and how to write clear asserts?
In this talk, we will provide a short introduction to writing solid unit tests in go. We will use examples from popular open source projects to demonstrate how leveraging test tools and test pattern can improve readability, speed and quality of your project.
We will discuss: Common testing terminology Advantages and disadvantages of popular test framework Methods to incorporate test tools and auto-generated code in your build pipeline Writing elegant data-driven tests in go.
In the end, attendees will have solid understanding on how to write clean idiomatic tests, what are the best-tools for the trade and how to incorporate them in your build pipeline.