testing

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2019 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package testing define helper / mock for unit testing

Because golang likes return error object instead of exception/panic, always handle error return values is a good practise. But sometimes it is impossible to got error, such as read from memory buffer, not handler them maybe maybe loose error because someday code changes, but handle them needs a lot of duplicate codes.

In package testing contains many test helper packages, suffix with `th', to handle these never happen errors. Test helper check the error result, if it is not nil, using testing.Fatal(err) to log the error object and abort current test case execution.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetupTeardown

func SetupTeardown(setup, teardown func(), f func(t *testing.T)) func(t *testing.T)

SetupTeardown add setup/teardown support to nested testing.T.Run() sub tests.

Wrap sub test function, run setup before sub test, defer teardown after sub test.

Both setup and teardown can be nil.

func TryWait

func TryWait(d time.Duration, try func() bool, timeout func())

TryWait the action until it returns true, call timeout if timeout.

Types

This section is empty.

Directories

Path Synopsis
Package matcher contains extended Matchers for gomega
Package matcher contains extended Matchers for gomega
mongo
reset package manage resettable operations useful for unit testing.
reset package manage resettable operations useful for unit testing.

Jump to

Keyboard shortcuts

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