Convey is the method intended for use when declaring the scopes of a specification. Each scope has a description and a func() which may contain other calls to Convey(), Reset() or Should-style assertions. Convey calls can be nested as far as you see fit.

IMPORTANT NOTE: The top-level Convey() within a Test method must conform to the following signature:

Convey(description string, t *testing.T, action func())

All other calls should look like this (no need to pass in *testing.T):

Convey(description string, action func())

Don't worry, goconvey will panic if you get it wrong so you can fix it.

Additionally, you may explicitly obtain access to the Convey context by doing:

Convey(description string, action func(c C))

You may need to do this if you want to pass the context through to a goroutine, or to close over the context in a handler to a library which calls your handler in a goroutine (httptest comes to mind).

All Convey()-blocks also accept an optional parameter of FailureMode which sets how goconvey should treat failures for So()-assertions in the block and nested blocks. See the constants in this file for the available options.

By default it will inherit from its parent block and the top-level blocks default to the FailureHalts setting.

This parameter is inserted before the block itself:

Convey(description string, t *testing.T, mode FailureMode, action func())
Convey(description string, mode FailureMode, action func())

See the examples package for, well, examples.