defs

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Scenario

type Scenario struct {
	//State is responsible for data flow inside one scenario
	State *gdutils.State
}

Scenario represents Scenario unit in context of godog framework

func (*Scenario) IGenerateARandomFloatInTheRangeToAndSaveItAs

func (s *Scenario) IGenerateARandomFloatInTheRangeToAndSaveItAs(from, to int, cacheKey string) error

IGenerateARandomFloatInTheRangeToAndSaveItAs generates random float from provided range and preserve it under given name in cache

func (*Scenario) IGenerateARandomIntInTheRangeToAndSaveItAs

func (s *Scenario) IGenerateARandomIntInTheRangeToAndSaveItAs(from, to int, cacheKey string) error

IGenerateARandomIntInTheRangeToAndSaveItAs generates random integer from provided range and preserve it under given name in cache

func (*Scenario) IGenerateARandomStringOfLengthWithUnicodeCharactersAndSaveItAs

func (s *Scenario) IGenerateARandomStringOfLengthWithUnicodeCharactersAndSaveItAs(strLength int, cacheKey string) error

IGenerateARandomStringOfLengthWithUnicodeCharactersAndSaveItAs generates random string of given length with unicode characters

func (*Scenario) IGenerateARandomStringOfLengthWithoutUnicodeCharactersAndSaveItAs

func (s *Scenario) IGenerateARandomStringOfLengthWithoutUnicodeCharactersAndSaveItAs(strLength int, cacheKey string) error

IGenerateARandomStringOfLengthWithoutUnicodeCharactersAndSaveItAs generates random string of given length without unicode characters

func (Scenario) IPrepareNewRequestToAndSaveItAs

func (s Scenario) IPrepareNewRequestToAndSaveItAs(method, urlTemplate, cacheKey string) error

IPrepareNewRequestToAndSaveItAs prepares new request and saves it in cache under cacheKey

func (*Scenario) IPrintLastResponseBody

func (s *Scenario) IPrintLastResponseBody() error

IPrintLastResponseBody prints response body from last scenario request

func (*Scenario) ISaveFromTheLastResponseJSONNodeAs

func (s *Scenario) ISaveFromTheLastResponseJSONNodeAs(expr, cacheKey string) error

ISaveFromTheLastResponseJSONNodeAs saves from last response json node under given cache key.

func (Scenario) ISendRequest

func (s Scenario) ISendRequest(cacheKey string) error

ISendRequest sends previously prepared HTTP(s) request

func (*Scenario) ISendRequestToWithBodyAndHeaders

func (s *Scenario) ISendRequestToWithBodyAndHeaders(method, urlTemplate string, reqBody *godog.DocString) error

ISendRequestToWithBodyAndHeaders sends HTTP(s) request with provided body and headers. Argument method indices HTTP(s) request method for example: "POST", "GET" etc. Argument urlTemplate should be full url path. May include template values. Argument bodyTemplate should be slice of bytes marshallable on bodyHeaders struct. May include template values

func (Scenario) ISetFollowingBodyForPreparedRequest

func (s Scenario) ISetFollowingBodyForPreparedRequest(cacheKey string, bodyTemplate *godog.DocString) error

ISetFollowingBodyForPreparedRequest sets body for previously prepared request bodyTemplate may be in any format and accepts template values

func (Scenario) ISetFollowingHeadersForPreparedRequest

func (s Scenario) ISetFollowingHeadersForPreparedRequest(cacheKey string, headersTemplate *godog.DocString) error

ISetFollowingHeadersForPreparedRequest sets provided headers for previously prepared request

func (*Scenario) IStartDebugMode

func (s *Scenario) IStartDebugMode() error

IStartDebugMode starts debugging mode

func (*Scenario) IStopDebugMode

func (s *Scenario) IStopDebugMode() error

IStopDebugMode stops debugging mode

func (*Scenario) IValidateLastResponseBodyWithSchema added in v1.0.1

func (s *Scenario) IValidateLastResponseBodyWithSchema(schemaPath string) error

IValidateLastResponseBodyWithSchema validates last response body against JSON schema as provided in schemaPath

func (*Scenario) IWait

func (s *Scenario) IWait(timeInterval string) error

IWait waits for provided time interval amount of time timeInterval should be string valid for time.ParseDuration func

func (*Scenario) TheJSONNodeShouldBe

func (s *Scenario) TheJSONNodeShouldBe(expr, goType string) error

TheJSONNodeShouldBe checks whether JSON node from last response body is of provided type goType may be one of: nil, string, int, float, bool, map, slice node should be expression acceptable by qjson package against JSON node from last response body

func (*Scenario) TheJSONNodeShouldBeOfValue

func (s *Scenario) TheJSONNodeShouldBeOfValue(expr, dataType, dataValue string) error

TheJSONNodeShouldBeOfValue finds JSON node from provided expression and compares it to expected by user value of given by user type available data types are listed in switch section in each case directive

func (*Scenario) TheJSONNodeShouldBeSliceOfLength

func (s *Scenario) TheJSONNodeShouldBeSliceOfLength(expr string, length int) error

TheJSONNodeShouldBeSliceOfLength finds JSON node from provided expression and checks whether given JSON node is slice and has given length

func (*Scenario) TheJSONNodeShouldNotBe

func (s *Scenario) TheJSONNodeShouldNotBe(expr, goType string) error

TheJSONNodeShouldNotBe checks whether JSON node from last response body is not of provided type goType may be one of: nil, string, int, float, bool, map, slice node should be expression acceptable by qjson package against JSON node from last response body

func (*Scenario) TheJSONResponseShouldHaveNode

func (s *Scenario) TheJSONResponseShouldHaveNode(expr string) error

TheJSONResponseShouldHaveNode checks whether last response body contains given JSON node

func (*Scenario) TheJSONResponseShouldHaveNodes

func (s *Scenario) TheJSONResponseShouldHaveNodes(nodesExpr string) error

TheJSONResponseShouldHaveNodes checks whether last request body has keys defined in string separated by comma nodeExpr should be valid according to qjson library expressions separated by comma (,)

func (*Scenario) TheResponseBodyShouldHaveType

func (s *Scenario) TheResponseBodyShouldHaveType(dataType string) error

TheResponseBodyShouldHaveType checks whether last response body has given data type available data types are listed as package constants

func (*Scenario) TheResponseShouldHaveHeader

func (s *Scenario) TheResponseShouldHaveHeader(name string) error

TheResponseShouldHaveHeader checks whether last HTTP response has given header

func (*Scenario) TheResponseShouldHaveHeaderOfValue

func (s *Scenario) TheResponseShouldHaveHeaderOfValue(name, value string) error

TheResponseShouldHaveHeaderOfValue checks whether last HTTP response has given header with provided value

func (*Scenario) TheResponseStatusCodeShouldBe

func (s *Scenario) TheResponseStatusCodeShouldBe(code int) error

TheResponseStatusCodeShouldBe checks last response status code

Jump to

Keyboard shortcuts

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