scenarios

package
v0.0.0-...-2ae8859 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2022 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CamelToSnakeCase

func CamelToSnakeCase(camel string) string

CamelToSnakeCase converts CamelCase to snake_case.

func ConfigureClients

func ConfigureClients(ctx context.Context, bddCTX gobdd.Context) (context.Context, func())

ConfigureClients sets up the Datadog API client for testing

func ConfigureSteps

func ConfigureSteps(s *gobdd.Suite)

ConfigureSteps on given suite.

func FinishSpanAfterStep

func FinishSpanAfterStep(ctx gobdd.Context)

FinishSpanAfterStep finishes the span and set error tags if needed.

func GetCleanup

func GetCleanup(ctx gobdd.Context) map[string]func()

GetCleanup functions.

func GetClient

func GetClient(ctx gobdd.Context) reflect.Value

GetClient get reflected value of client instance.

func GetClientVersion

func GetClientVersion(ctx gobdd.Context, version string) (reflect.Value, error)

GetClientVersion returns the client matching the given version

func GetCtx

func GetCtx(ctx gobdd.Context) context.Context

GetCtx returns Go context.

func GetData

func GetData(ctx gobdd.Context) map[string]interface{}

GetData returns feature context.

func GetIgnoredTags

func GetIgnoredTags() []string

GetIgnoredTags returns list of ignored tags.

func GetJSONResponse

func GetJSONResponse(ctx gobdd.Context) interface{}

GetJSONResponse returns request response.

func GetRequestArguments

func GetRequestArguments(ctx gobdd.Context) []interface{}

GetRequestArguments helps to build a request.

func GetRequestParameters

func GetRequestParameters(ctx gobdd.Context) map[string]interface{}

GetRequestParameters helps to build a request.

func GetRequestsUndo

func GetRequestsUndo(ctx gobdd.Context, version string, operationID string) (func([]reflect.Value) func(), error)

GetRequestsUndo gets map with undo function for each request.

func GetResponse

func GetResponse(ctx gobdd.Context) []reflect.Value

GetResponse returns request response.

func GetResponseStatusCode

func GetResponseStatusCode(resp []reflect.Value) (int, error)

GetResponseStatusCode returns request response status code.

func GetT

func GetT(ctx gobdd.Context) *testing.T

GetT returns stored reference to the testing object.

func GetVersion

func GetVersion(ctx gobdd.Context) string

GetVersion gets package version.

func LoadRequestsUndo

func LoadRequestsUndo(file string) (map[string]UndoAction, error)

LoadRequestsUndo load undo configuration.

func RunCleanup

func RunCleanup(ctx gobdd.Context)

RunCleanup executes cleanup functions in controlled ordered based on registered keys.

func SetAPI

func SetAPI(ctx gobdd.Context, value interface{})

SetAPI sets client API.

func SetCleanup

func SetCleanup(ctx gobdd.Context, value map[string]func())

SetCleanup functions.

func SetClient

func SetClient(ctx gobdd.Context, value interface{})

SetClient sets client reflection.

func SetCtx

func SetCtx(ctx context.Context, bddCTX gobdd.Context)

SetCtx sets Go context in BDD context.

func SetData

func SetData(ctx gobdd.Context, value map[string]interface{})

SetData sets feature context.

func SetFixtureData

func SetFixtureData(ctx gobdd.Context)

SetFixtureData sets the fixture data in BDD context

func SetRequestsUndo

func SetRequestsUndo(ctx gobdd.Context, value map[string]map[string]UndoAction)

SetRequestsUndo sets map with undo function for each request.

func SetVersion

func SetVersion(ctx gobdd.Context, version string)

SetVersion sets package version.

func SnakeToCamelCase

func SnakeToCamelCase(snake string) (camel string)

SnakeToCamelCase converts snake_case to SnakeCase.

func StartSpanBeforeStep

func StartSpanBeforeStep(ctx gobdd.Context)

StartSpanBeforeStep configures tags on a new span.

func Templated

func Templated(t gobdd.StepTest, data map[string]interface{}, source string) string

Templated replaces {{ path }} in source with value from data[path]. If path contains `(`, `)`, then it's a function to call, with the args between brackets.

func ToVarName

func ToVarName(param string) (varName string)

ToVarName converts a string to a valid Go variable name.

Types

type GivenStep

type GivenStep struct {
	Tag         string               `json:"tag"`
	Key         string               `json:"key"`
	Step        string               `json:"step"`
	OperationID string               `json:"operationId"`
	Parameters  []operationParameter `json:"parameters"`
	Source      *string              `json:"source"`
}

GivenStep defines a step.

func LoadGivenSteps

func LoadGivenSteps(file string) ([]GivenStep, error)

LoadGivenSteps load undo configuration.

func (GivenStep) RegisterSuite

func (s GivenStep) RegisterSuite(suite *gobdd.Suite, version string)

RegisterSuite adds step implementation.

type UndoAction

type UndoAction struct {
	Tag  string `json:"tag"`
	Undo *struct {
		Type        string `json:"type"`
		OperationID string `json:"operationId"`
		Parameters  []struct {
			Name     string  `json:"name"`
			Source   *string `json:"source"`
			Template *string `json:"template"`
		} `json:"parameters"`
	} `json:"undo"`
}

UndoAction describes undo action.

Jump to

Keyboard shortcuts

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