Documentation ¶
Index ¶
- Variables
- type Cell
- type DataTable
- type DocString
- type HeaderTable
- type Runner
- func (r *Runner) After(hook interface{}) *Runner
- func (r *Runner) AfterStep(hook interface{}) *Runner
- func (r *Runner) Before(hook interface{}) *Runner
- func (r *Runner) BeforeStep(hook interface{}) *Runner
- func (r *Runner) NonParallel() *Runner
- func (r *Runner) Path(paths ...string) *Runner
- func (r *Runner) Run()
- func (r *Runner) ShortTags(tagExpr string) *Runner
- func (r *Runner) Step(step interface{}, definition interface{}) *Runner
- func (r *Runner) Tags(tagExpr string) *Runner
- type Scenario
- type Step
- type TestingT
Constants ¶
This section is empty.
Variables ¶
var Version = "v0.0.0-dev"
Version of package - based on Semantic Versioning 2.0.0 http://semver.org/
Functions ¶
This section is empty.
Types ¶
type Cell ¶
type Cell struct {
// contains filtered or unexported fields
}
Cell represents a data table cell.
type DataTable ¶
type DataTable struct {
// contains filtered or unexported fields
}
DataTable wraps a data table step argument
func (DataTable) HeaderTable ¶
func (d DataTable) HeaderTable() *HeaderTable
HeaderTable returns the data table as a header table which is a wrapper around the table which assumes that the first row is the table header.
type HeaderTable ¶
type HeaderTable struct { DataTable // contains filtered or unexported fields }
HeaderTable is a wrapper around a table which assumes that the first row is \ the table header.
func (*HeaderTable) Get ¶
func (h *HeaderTable) Get(row int, col string) *Cell
Get returns the cell at the provided row offset (skipping the header row) and column name (as indicated in the header).
func (*HeaderTable) NumRows ¶
func (h *HeaderTable) NumRows() int
NumRows returns the number of rows in the table (excluding the header row).
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
Runner is a test runner.
func NewRunner ¶
NewRunner constructs a new Runner with the provided suite type instance. Suite type is expected to be a pointer to a struct or a struct. A new instance of suiteType will be constructed for every scenario.
The following special argument types will be injected into exported fields of the suite type struct: TestingT, Scenario, Step, *rapid.T.
Methods defined on the suite type will be auto-registered as step definitions if they correspond to the expected method name for a step. Method parameters can start with the special argument types listed above and must be followed by step argument types for each captured step argument and DocString or DataTable at the end if the step uses one of these. Valid step argument types are int64, string, *big.Int and *apd.Decimal.
The methods Before, After, BeforeStep and AfterStep will be recognized as hooks and can take the special argument types listed above.
func (*Runner) After ¶
After registers an after hook function which can take special step arguments. This hook will be called even when the test fails.
func (*Runner) AfterStep ¶
AfterStep registers an after step hook function which can take special step arguments. This hook will be called even when the test fails.
func (*Runner) Before ¶
Before registers a before hook function which can take special step arguments.
func (*Runner) BeforeStep ¶
BeforeStep registers a before step hook function which can take special step arguments.
func (*Runner) NonParallel ¶
NonParallel instructs the runner not to run tests in parallel (which is the default).
func (*Runner) Path ¶
Path specifies glob paths for the runner to look up .feature files. The default is `features/*.feature`.
func (*Runner) ShortTags ¶
ShortTags specifies which tag expression will be used to select for tests when testing.Short() is true. This tag expression will be combined with any other tag expression that is applied with Tags() when running short tests.
func (*Runner) Step ¶
Step can be used to manually register a step with the runner. step should be a string or *regexp.Regexp instance. definition should be a function which takes special step arguments first and then regular step arguments next (with string, int64, *big.Int, and *apd.Decimal as valid types) and gocuke.DocString or gocuke.DataTable as the last argument if this step uses a doc string or data table respectively. Custom step definitions will always take priority of auto-discovered step definitions.
type Scenario ¶
type Scenario interface { Name() string Tags() []string URI() string // contains filtered or unexported methods }
Scenario is a special step argument type which describes the running scenario and that can be used in a step definition or hook method.
type Step ¶
type Step interface { Text() string // contains filtered or unexported methods }
Step is a special step argument type which describes the running step and that can be used in a step definition or hook method.
type TestingT ¶
type TestingT interface { Cleanup(func()) Error(args ...interface{}) Errorf(format string, args ...interface{}) Fail() FailNow() Failed() bool Fatal(args ...interface{}) Fatalf(format string, args ...interface{}) Log(args ...interface{}) Logf(format string, args ...interface{}) Skip(args ...interface{}) SkipNow() Skipf(format string, args ...interface{}) Helper() }
TestingT is the common subset of testing methods exposed to test suite instances and expected by common assertion and mocking libraries.