Let’s take for example an incredibly simple code and imagine that it’s incredibly complicated logic. def cat(left, right): """Concatenate two given strings. """ return left + right Tests How can we be sure this code works? No, it’s not obvious. Remember the rules of the game, we have an incredibly complicated realization. So, we can’t say it works or not while we haven’t tested it. def test_cat(): result = cat(left='abc', right='def') assert result == 'abcdef' Now, run pytest:| blog.orsinium.dev
This article is intended as a short introduction to the mechanics and syntax of writing a table driven test in Go. Supporting this article is a small repository, https://github.com/davecheney/fib, which contains all the code mentioned below.| Dave Cheney
Opinions on how to write good tests, some controversial| blog.gnoack.org
Describes Prig, which is for Processing Records In Go. It's a text processing tool like AWK, but it uses Go as the scripting language.| benhoyt.com