Documentation ¶
Index ¶
- Constants
- Variables
- func ColumnsChecker(cells []*messages.PickleTableCell, n int) error
- func ContainsString(expected string, values []string) bool
- func ConvertTableColumnToArray(ctx context.Context, t *godog.Table) ([]string, error)
- func ConvertTableToMap(ctx context.Context, t *godog.Table) (map[string]interface{}, error)
- func ConvertTableToMultiMap(ctx context.Context, t *godog.Table) (map[string][]string, error)
- func ConvertTableWithHeaderToStructSlice(ctx context.Context, t *godog.Table, slicePtr interface{}) error
- func ConvertTableWithoutHeaderToStruct(ctx context.Context, t *godog.Table, v interface{}) error
- func GetConfig() *cfg.Config
- func InitializeContext(ctx context.Context) context.Context
- func NewTable(src [][]string) *godog.Table
- func RemoveHeaders(t *godog.Table) error
- func Value(ctx context.Context, s string) interface{}
- func ValueAsInt(ctx context.Context, s string) (int, error)
- func ValueAsString(ctx context.Context, s string) string
- type ComposedTag
- type ConfigurePattern
- type Context
- type ContextKey
- type FieldConversor
- type KindFormatter
- type Launcher
- type Logger
- type Map
- type NamedTag
- type StepsInitializer
- type StringTag
- type Tag
Constants ¶
const (
SUFFIX = ".log"
)
Variables ¶
var StrategyFormat = map[reflect.Kind]*FieldConversor{ reflect.Slice: NewSliceConverter(), reflect.String: NewStringConverter(), reflect.Bool: NewBoolConverter(), reflect.Int: NewInt64Converter(), reflect.Int8: NewInt64Converter(), reflect.Int16: NewInt64Converter(), reflect.Int32: NewInt64Converter(), reflect.Int64: NewInt64Converter(), reflect.Uint: NewUInt64Converter(), reflect.Uint8: NewUInt64Converter(), reflect.Uint16: NewUInt64Converter(), reflect.Uint32: NewUInt64Converter(), reflect.Uint64: NewUInt64Converter(), reflect.Float32: NewFloat64Converter(), reflect.Float64: NewFloat64Converter(), reflect.Complex64: NewComplex64Converter(), reflect.Complex128: NewComplex64Converter(), }
Functions ¶
func ColumnsChecker ¶ added in v0.15.2
func ColumnsChecker(cells []*messages.PickleTableCell, n int) error
func ContainsString ¶
ContainsString check if a expected value is included in a slice of values.
func ConvertTableColumnToArray ¶
ConvertTableColumnToArray converts a godog table with 1 column into a []string.
func ConvertTableToMap ¶
ConvertTableToMap converts a godog table with 2 columns into a map[string]interface{}.
func ConvertTableToMultiMap ¶
ConvertTableToMultiMap converts a godog table with 2 columns into a map[string][]string. The multimap is using url.Values. The multimap is useful to support multiple values for the same key (e.g. for query parameters or HTTP headers).
func GetConfig ¶
GetConfig returns the golium configuration. This configuration includes relevant information as the environment or the directories for some assets or log files.
func InitializeContext ¶
InitializeContext adds the Context to the context. The new context is returned because context is immutable.
func NewTable ¶ added in v0.15.2
NewTable Aux function that creates a new table from string matrix for testing purposes.
func RemoveHeaders ¶ added in v0.15.2
Remove headers form table
func Value ¶
Value converts a value as a string to consider some golium patterns. Supported patterns:
- Booleans: [TRUE] or [FALSE]
- Null value: [NULL]
- Empty value: [EMPTY]
- Number: [NUMBER:1234] or [NUMBER:1234.67]
- Configuration parameters: [CONF:test.parameter]
- Context values: [CTXT:test.context]
- SHA256: [SHA256:text.to.be.hashed]
- BASE64: [BASE64:text.to.be.base64.encoded]
- Time: [NOW:+24h:unix] with the format: [NOW:{duration}:{format}] The value {duration} can be empty (there is no change from now timestamp) or a format valid for time.ParseDuration function. Currently, it supports the following units: "ns", "us", "ms", "s", "m", "h". The format can be "unix" or a layout valid for time.Format function. It is possible to use [NOW]. In that case, it returns an int64 with the now timestamp in unix format.
Most cases, the return value is a string except for the following cases: - [TRUE] and [FALSE] return a bool type. - [NUMBER:1234] returns a float64 if s only contains this tag and there is no surrounding text. - [NOW:{duration}:{format}] returns an int64 when {format} is "unix".
func ValueAsInt ¶
ValueAsInt invokes Value and converts the return value to int.
Types ¶
type ComposedTag ¶
type ComposedTag struct {
// contains filtered or unexported fields
}
ComposedTag is a composition of tags, including StringTags, NamedTags and other ComposedTags to provide an evaluation.
func (ComposedTag) Value ¶
func (t ComposedTag) Value(ctx context.Context) interface{}
type ConfigurePattern ¶ added in v0.16.0
type ConfigurePattern func(destination reflect.Value, fieldValueStr string, value interface{}) error
ConfigurePattern func to apply transformation into destination
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context contains the context required for common utilities. It contains a map[string]interface{} to store global values and find them with [CTXT:xxx] tag.
func GetContext ¶
GetContext returns the Context stored in context. Note that the context should be previously initialized with InitializeContext function.
type ContextKey ¶
type ContextKey string
ContextKey defines a type to store the Context in context.Context.
type FieldConversor ¶ added in v0.16.0
type FieldConversor struct {
Pattern ConfigurePattern
}
FieldConversor
func NewBoolConverter ¶ added in v0.16.0
func NewBoolConverter() *FieldConversor
NewBoolConverter Constructor
func NewComplex64Converter ¶ added in v0.16.0
func NewComplex64Converter() *FieldConversor
NewComplex64Converter Constructor
func NewFloat64Converter ¶ added in v0.16.0
func NewFloat64Converter() *FieldConversor
NewFloat64Converter Constructor
func NewInt64Converter ¶ added in v0.16.0
func NewInt64Converter() *FieldConversor
NewInt64Converter Constructor
func NewSliceConverter ¶ added in v0.16.0
func NewSliceConverter() *FieldConversor
NewSliceConverter Constructor
func NewStringConverter ¶ added in v0.16.0
func NewStringConverter() *FieldConversor
NewStringConverter Constructor
func NewUInt64Converter ¶ added in v0.16.0
func NewUInt64Converter() *FieldConversor
NewUInt64Converter Constructor
type KindFormatter ¶ added in v0.16.0
type KindFormatter interface {
// contains filtered or unexported methods
}
KindFormatter with format to apply conversion
type Launcher ¶
type Launcher struct {
// contains filtered or unexported fields
}
Launcher is responsible to launch golium (based on godog). The default configuration is merged with environment variables.
func NewLauncherWithYaml ¶
NewLauncherWithYaml with a configuration from a yaml file. The yaml file is merged with environment variables.
type Logger ¶ added in v0.16.0
Logger logs in a configurable file.
func GetLogger ¶ added in v0.16.0
func GetLogger() *Logger
GetLogger returns the logger for DNS requests and responses. If the logger is not created yet, it creates a new instance of Logger.
func LoggerFactory ¶ added in v0.16.0
LoggerFactory returns a Logger instance.
type Map ¶
type Map interface {
Get(path string) interface{}
}
Map is an interface to get elements from a data structure with a dot notation.
func GetEnvironment ¶
func GetEnvironment() Map
GetEnvironment returns the environment configuration.
func NewMapFromJSONBytes ¶
NewMapFromJSONBytes creates a Map from a slice of bytes of a JSON document.
type NamedTag ¶
type NamedTag struct {
// contains filtered or unexported fields
}
NamedTag is a Tag that can be evaluated with a tag function depending on the name of the tag.
type StepsInitializer ¶
type StepsInitializer interface { // InitializeSteps initializes a set of steps (e.g. http steps) to make them available // but using a context. InitializeSteps(ctx context.Context, scenCtx *godog.ScenarioContext) context.Context }
StepsInitializer is an interface to initialize the steps in godog, but extending godog initializer with a context.
type StringTag ¶
type StringTag struct {
// contains filtered or unexported fields
}
StringTag represents a implicit tag composed of a text. This tag is used to compose a string with a tag to generate a new string.
type Tag ¶
Tag interface to calculate the value of a tag. A golium tag is a text surrounded by brackets that can be evaluated into a value. For example: [CONF:property]
func NewStringTag ¶
NewStringTag creates a Tag that evaluated to the string without any modification.