Cogol is a beautiful, easy-configurable tool for writing unit-tests in Go
programming language.
Install Cogol
by running
$ go get github.com/kyeeego/cogol
Next, create typical *_test.go
file and copy and paste the following code inside it.
package test
import (
"github.com/kyeeego/cogol"
"testing"
)
func TestSomething(t *testing.T) {
cgl := cogol.Init(t)
g := cgl.Group("test")
{
g.T("Adds two numbers", func(c *cogol.Context) {
c.Expect(2 + 2).ToBe(4)
})
}
cgl.Process()
}
Run it with
$ go test
and get the following output
You successfully wrote your first test with Cogol!