Living Systems_

Testing

Viewing Go test coverage in the browser with one command

Go has some really nice tools for running tests and analyzing code. One of these functionalities is that you can generate coverage information when running tests, that can later be viewed in a browser using the go tool cover command. It turns out though, since doing it requires executing multiple commands after each other, it might be hard to remember the exact commands. To this end, I created a bash alias that does everything in one command, gocov.

Table-driven tests in C#

Folks in the Go community have championed so called table-driven tests (see e.g. this post by Dave Cheney and the Go wiki ) as a way to quickly and easily writing up a bunch of complete test cases with inputs and corresponding expected outputs, and looping over them to execute the function being tested. In short, the idea is to suggest a maximally short and convenient syntax to do this.

The role of simplicity in testing and automation

Disclaimer: Don’t take this too seriously … this is “thinking-in-progress” :) It just struck me the other minute, how simplicity is the key theme behind two very important areas in software development, that I’ve been dabbling with quite a bit recently: Testing, and automation. Have you thought about how testing, in its essence, is: Wrapping complex code, which you can’t mentally comprehend completely, in simple code, that you can mentally comprehend, at least one test at a time.