Golang testify

From wikinotes

Testify is a 3rd party test library for golang.
It includes assertions and mocks.

It's functionality is modular, opt in to the features you are interested in.

  • assert
  • require
  • mock
  • suite

Documentation

github https://github.com/stretchr/testify

Install

go get github.com/stretchr/testify

Usage

Assertions

All assertions allow passing a more descriptive message.

import (
    "github.com/stretchr/testify/assert"
)
assert.Equal(t, expects, result)
assert.Equal(t, expects, result, "they should be equal")

Assertions

assert.Equal(t, 123, 123)
assert.NotEqual(t, 123, 100)
assert.NotNil(t, 123)

Mocks

haven't used yet

Suite

haven't used yet