neko

package module
v0.0.0-...-99acbdf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 2, 2017 License: BSD-3-Clause Imports: 2 Imported by: 0

README

neko - a simple golang test organizer

Doc's from Godoc.org!

There are many tools for improving Go's tests.

It's hard to beat the simplicity of go test but we all know it can get, well, a little disorganized.

neko helps by just give you an extra little bit of organization to perform common setup between tests.

Oh, and it integrates with github.com/stretchr/testify/mock to coordinate your mocks (clearing and asserting them).

Here is a quick example:

import (
  "testing"
  "github.com/vektra/neko"
)

func TestNekoEnjoysFun(t *testing.T) {
	n := neko.Start(t)

	var fun Fun

	n.Setup(func() {
		fun = CreateAmeowsements()
	})

	n.It("enjoys fun", func() {
		if !fun.IsFun() {
			t.Fatal("fun isn't fun?? :( :(")
		}
	})

	n.It("knows when it's fun time", func() {
		if !fun.ItsTime() {
			t.Fatal("no fun time? :( :(")
		}
	})

  n.Meow()
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Organizer

type Organizer struct {
	// contains filtered or unexported fields
}

func Start

func Start(t *testing.T) *Organizer

Create a new Organizer against testing's T interface

func (*Organizer) CheckMock

func (o *Organizer) CheckMock(m *mock.Mock)

Track a github.com/stretchr/testify/mock.Mock along with the tests

func (*Organizer) Cleanup

func (o *Organizer) Cleanup(f func())

Add some work to be done after each test

func (*Organizer) It

func (o *Organizer) It(name string, f func())

Add a test.

func (*Organizer) Meow

func (o *Organizer) Meow()

Have fun with neko!

func (*Organizer) NIt

func (o *Organizer) NIt(name string, f func())

Useful by allowing the developer to simply add 'N' before It to disable a block.

func (*Organizer) Only

func (o *Organizer) Only(name string, f func())

func (*Organizer) Run

func (o *Organizer) Run()

Coordinate running the tests with the setups and mocks

func (*Organizer) Setup

func (o *Organizer) Setup(f func())

Add some work to be done before each test

type OrganizerModern

type OrganizerModern struct {
	// contains filtered or unexported fields
}

func Modern

func Modern(t *testing.T) *OrganizerModern

Create a new OrganizerModern against testing's T interface

func (*OrganizerModern) CheckMock

func (o *OrganizerModern) CheckMock(m *mock.Mock)

Track a github.com/stretchr/testify/mock.Mock along with the tests

func (*OrganizerModern) Cleanup

func (o *OrganizerModern) Cleanup(f func())

Add some work to be done after each test

func (*OrganizerModern) It

func (o *OrganizerModern) It(name string, f func(t *testing.T))

Add a test.

func (*OrganizerModern) Meow

func (o *OrganizerModern) Meow()

Have fun with neko!

func (*OrganizerModern) NIt

func (o *OrganizerModern) NIt(name string, f func(t *testing.T))

Useful by allowing the developer to simply add 'N' before It to disable a block.

func (*OrganizerModern) Only

func (o *OrganizerModern) Only(name string, f func(t *testing.T))

func (*OrganizerModern) Run

func (o *OrganizerModern) Run()

Coordinate running the tests with the setups and mocks

func (*OrganizerModern) Setup

func (o *OrganizerModern) Setup(f func())

Add some work to be done before each test

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL