Documentation
¶
Overview ¶
Package assertions provides common assertion utilities for all testing modules
Package assertions provides common assertion utilities and types for all testing modules
Index ¶
- type Asserter
- func (a *Asserter) Contains(haystack, needle string, message string) bool
- func (a *Asserter) Equal(expected, actual interface{}, message string) bool
- func (a *Asserter) False(value bool, message string) bool
- func (a *Asserter) GetSteps() []AssertionStep
- func (a *Asserter) Greater(actual, expected interface{}, message string) bool
- func (a *Asserter) HasFailures() bool
- func (a *Asserter) Less(actual, expected interface{}, message string) bool
- func (a *Asserter) Nil(value interface{}, message string) bool
- func (a *Asserter) NotContains(haystack, needle string, message string) bool
- func (a *Asserter) NotEqual(expected, actual interface{}, message string) bool
- func (a *Asserter) NotNil(value interface{}, message string) bool
- func (a *Asserter) Reset()
- func (a *Asserter) True(value bool, message string) bool
- type AssertionStep
- type TestStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Asserter ¶
type Asserter struct {
// contains filtered or unexported fields
}
Asserter provides assertion capabilities for tests
func (*Asserter) GetSteps ¶
func (a *Asserter) GetSteps() []AssertionStep
GetSteps returns all assertion steps
func (*Asserter) HasFailures ¶
HasFailures returns true if any assertions failed
func (*Asserter) NotContains ¶
NotContains asserts that a string does not contain a substring
type AssertionStep ¶
type AssertionStep struct {
Name string `json:"name"`
Description string `json:"description"`
Status TestStatus `json:"status"`
Error error `json:"error,omitempty"`
Duration time.Duration `json:"duration"`
StartTime time.Time `json:"start_time"`
EndTime time.Time `json:"end_time"`
Expected interface{} `json:"expected,omitempty"`
Actual interface{} `json:"actual,omitempty"`
}
AssertionStep represents a single assertion step in a test
type TestStatus ¶
type TestStatus string
TestStatus represents the status of a test
const ( TestStatusPassed TestStatus = "passed" TestStatusFailed TestStatus = "failed" TestStatusSkipped TestStatus = "skipped" TestStatusError TestStatus = "error" )
func (TestStatus) String ¶
func (ts TestStatus) String() string
String returns the string representation of TestStatus
Click to show internal directories.
Click to hide internal directories.