assertion

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2020 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Equal           = AssertMethod{AssertFunc: assertion.Equal, LongName: "Equal", ShortName: "EQ", Symbol: "==", IsEqualType: true}
	NotEqual        = AssertMethod{AssertFunc: assertion.NotEqual, LongName: "NotEqual", ShortName: "NEQ", Symbol: "!=", IsEqualType: true}
	OrderedEqual    = AssertMethod{AssertFunc: assertion.Equal, LongName: "OrderedEqual", ShortName: "OEQ", Symbol: "#==", IsEqualType: true, IsOrdered: true}
	Contain         = AssertMethod{AssertFunc: assertion.Contains, LongName: "Contains", ShortName: "CTN", Symbol: "$$", IsContainType: true}
	LessThan        = AssertMethod{AssertFunc: assertion.LessThan, LongName: "LessThan", ShortName: "LT", Symbol: "<", IsContainType: false, IsNumericType: true}
	GreaterThan     = AssertMethod{AssertFunc: assertion.GreaterThan, LongName: "GreaterThan", ShortName: "GT", Symbol: ">", IsContainType: false, IsNumericType: true}
	LessThanOrEq    = AssertMethod{AssertFunc: assertion.LessThanOrEq, LongName: "LessThanOrEqual", ShortName: "LTE", Symbol: "<=", IsContainType: false, IsNumericType: true}
	GreaterThanOrEq = AssertMethod{AssertFunc: assertion.GreaterThanOrEq, LongName: "GreaterThanOrEqual", ShortName: "GTE", Symbol: ">=", IsContainType: false, IsNumericType: true}
)

Functions

func ApplyAssert

func ApplyAssert(probeAnswer *probe.ProbeAnswer, tAssert *Assert) (assertRes bool, failCause string)

ApplyAssert find the corresponding value to assert in probeAnswer then asserts the probe value with the expected value.

Types

type Assert

type Assert struct {
	Key          string       // Key in wich to pick the value from a probe result
	Method       AssertMethod // Assert method (equal, sup, contains ...)
	Value        interface{}  // value to assert
	Values       []string     // values to assert
	ResultStatus int8         //TODO: à typer en teststruct.Status like
	ResultAssert string       // ok, or assert fail msg
}

func GetCleanAsserts

func GetCleanAsserts(rawAsserts []string) ([]Assert, error)

GetCleanAsserts returns a structured TestStep Assertion Slice from raw assert string. this assertion slice has been validate.

func (Assert) AssertConditionsLong

func (a Assert) AssertConditionsLong() string

func (Assert) ToAssertDesc

func (a Assert) ToAssertDesc() AssertDesc

func (Assert) ToAssertJSON

func (a Assert) ToAssertJSON() *AssertShortJSON

ToAssertJSON returns a struct with content easily readable

type AssertDesc

type AssertDesc struct {
	LongAssert   string `json:"assertion"`
	ResultStatus int8   `json:"resultstatus"`
	ResultAssert string `json:"resultassert"`
}

type AssertMethod

type AssertMethod struct {
	LongName      string
	ShortName     string
	Symbol        string
	IsNumericType bool
	IsEqualType   bool
	IsContainType bool
	IsOrdered     bool
	IsDuration    bool
	AssertFunc    func(actualValue interface{}, actualValues []string, expectValue interface{}, expectValueValues []string) (bool, string) `hash:"ignore"`
}

type AssertResult

type AssertResult struct {
	Assertion    string
	ResultStatus int8   //TODO: à typer en teststruct.Status like
	ResultAssert string // ok, or assert fail msg
}

type AssertShortJSON

type AssertShortJSON struct {
	Key    string `json:"key"`
	Method string `json:"method"`
	Value  string `json:"value"`
}

type AssertionsApplied

type AssertionsApplied struct {
	Ok       bool
	Failures []string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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