Documentation ¶
Index ¶
- func AssertResponseContentContainsValues(ctx *Context, values map[string]string) error
- func LoadOpenApiSchemaFromFile(filePath string) (openapi.Schema, error)
- func LoadOpenApiSchemaFromUrl(uri string) (openapi.Schema, error)
- func MustLoadOpenApiSchemaFromFile(filePath string) openapi.Schema
- func MustLoadOpenApiSchemaFromUrl(uri string) openapi.Schema
- func RunSimpleTestSuite(t *testing.T, initScenario func(ctx *godog.ScenarioContext), features []string)
- func ValidateResponseBody(ctx *Context) error
- type Context
- type Dispatcher
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertResponseContentContainsValues ¶
Assert that the response body contains certain values Deep-nested json properties can be referenced using dot notation Properties not passed in the values map are ignored
func LoadOpenApiSchemaFromFile ¶
Load an OpenApi schema from a file
func LoadOpenApiSchemaFromUrl ¶
Load an OpenApi schema from a URL
func MustLoadOpenApiSchemaFromFile ¶
Load an OpenApi schema from a file, or panic if something goes wrong
func MustLoadOpenApiSchemaFromUrl ¶
Load an OpenApi schema from a URL, or panic if something goes wrong
func RunSimpleTestSuite ¶
func RunSimpleTestSuite(t *testing.T, initScenario func(ctx *godog.ScenarioContext), features []string)
func ValidateResponseBody ¶
Validates a response against the OpenAPI schema
Types ¶
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context struct is the main state manager that you interact with
func InitializeScenario ¶
func InitializeScenario(scenario *godog.ScenarioContext, opts Options) (*Context, error)
Initialize a godog scenario with a default context. Returns the context object so you can use it for extended DSLs
func InitializeScenarioWithContext ¶
func InitializeScenarioWithContext(scenario *godog.ScenarioContext, ctx *Context) (*Context, error)
Initialzie a godog scenario by passing in your own context Returns the context object so you can use it for extended DSLs
func (*Context) GetResponse ¶
Returns the http response The request will be triggerred if it has not already been sent
func (*Context) GetResponseBody ¶
Returns the http response body The request will be triggerred if it has not already been sent
func (*Context) SetOperation ¶
Specifies the operation to be called
type Dispatcher ¶
The Dispatcher interface provides a way for cucumboa to call OpenApi operations on a target system
func CreateHandlerDispatcher ¶
func CreateHandlerDispatcher(handler http.Handler) Dispatcher
Craetes a cucumboa dispatcher that runs against a local http.Handler instance to allow testing in-memory without needing an http server
type Options ¶
type Options struct { // Path or URL to OpenApi schema for this API Schema openapi.Schema // Http dispatcher to handle sending of HTTP requests to your API Dispatcher Dispatcher }