gspec: Index | Files | Directories

package gspec

import ""

Package gspec is an expressive, reliable, concurrent and extensible Go test framework that makes it productive to organize and verify the mind model of software.

- Expressive: a complete runnable specification can be organized via both BDD and table driven styles.
- Reliable:   the implementation has minimal footprint and is tested with 100% coverage.
- Concurrent: test cases can be executed concurrently or sequentially.
- Extensible: customizable BDD cue words, expectations and test reporters.
- Compatible: "go test" is sufficient but not mandatory to run GSpec tests.

GSpec is very modular and sub packages have minimal or no dependance on each other. The top package "gspec" integrates all other sub packages and provide a quick way of test gathering, executing and reporting.


Package Files

doc.go quick.go util.go


var (
    // Reporters are the test reporters used during the test.
    Reporters = []ext.Reporter{
        reporter.NewTextReporter(os.Stdout, Verbose()),

func Add Uses

func Add(fs ...TestFunc) int

Add GSpec test functions to the global test suite. Return value has no meaning, allowing it to be called in global scope.

func Alias2 Uses

func Alias2(n1, n2 string, s S) (_, _ core.DescFunc)

Alias2 accepts 2 names and returns 2 alias DescFuncs.

func Alias3 Uses

func Alias3(n1, n2, n3 string, s S) (_, _, _ core.DescFunc)

Alias3 accepts 3 names and returns 3 alias DescFuncs.

func Alias4 Uses

func Alias4(n1, n2, n3, n4 string, s S) (_, _, _, _ core.DescFunc)

Alias4 accepts 4 names and returns 4 alias DescFuncs.

func Alias5 Uses

func Alias5(n1, n2, n3, n4, n5 string, s S) (_, _, _, _, _ core.DescFunc)

Alias5 accepts 5 names and returns 5 alias DescFuncs.

func Expect Uses

func Expect(fail interface{}, skip expectation.ExpectFunc

Expect is a trivial wrapper of expectation.Alias for GSpec or Go tests.

func SetSprint Uses

func SetSprint(sprint func(interface{}) string)

SetSprint is a trivial wrapper to set error.Sprint.

func Test Uses

func Test(t T)

Test method runs all tests in the global test suite.

func Unindent Uses

func Unindent(s string) string

Unindent is a utility function that unindents Go's raw string literal by the indent guessed from the first nonblank line, so the raw string literal can be indented as normal code and looks better. A prefix and a suffix newline '\n' will be added if there is none.

func Verbose Uses

func Verbose() bool

Verbose returns value of "test.v" flag without depending on the testing package.

type S Uses

type S struct {

S is a trivial wrapper to core.S.

type T Uses

type T interface {

T is an interface that allows a testing.T to be passed without depending on the testing package.

type TestFunc Uses

type TestFunc func(S)

TestFunc is a trivial wrapper to core.TestFunc.


atexitPackage atexit add the missing atexit functionality in the testing package.
corePackage core provides a minimal core for organizing, executing and reporting of test cases nested in test groups.
errorsPackage errors provides all types of test error.
expectationPackage expectation provides expectation (assertion) helpers.
extensionPackage extension contains the types for extending the core package.
reporterPackage reporter contains all the builtin test reporters.

Package gspec imports 10 packages (graph). Updated 2018-05-11. Refresh now. Tools for package owners. This is an inactive package (no imports and no commits in at least two years).