Documentation
ΒΆ
Index ΒΆ
- Variables
- func BoolVarFromCtx(ctx context.Context, varname string) bool
- func Debug(ctx context.Context, format string, args ...interface{})
- func Dump(v interface{}) (map[string]interface{}, error)
- func DumpString(v interface{}) (map[string]string, error)
- func DumpStringPreserveCase(v interface{}) (map[string]string, error)
- func Error(ctx context.Context, format string, args ...interface{})
- func Fatal(ctx context.Context, format string, args ...interface{})
- func GetExecutorResult(r interface{}) map[string]interface{}
- func Info(ctx context.Context, format string, args ...interface{})
- func InitTestLogger(t *testing.T)
- func IntVarFromCtx(ctx context.Context, varname string) int
- func JSONUnmarshal(btes []byte, i interface{}) error
- func RemoveNotPrintableChar(in string) string
- func StringMapInterfaceVarFromCtx(ctx context.Context, varname string) map[string]interface{}
- func StringMapStringVarFromCtx(ctx context.Context, varname string) map[string]string
- func StringSliceVarFromCtx(ctx context.Context, varname string) []string
- func StringVarFromCtx(ctx context.Context, varname string) string
- func VarFromCtx(ctx context.Context, varname string) interface{}
- func Warn(ctx context.Context, format string, args ...interface{})
- func Warning(ctx context.Context, format string, args ...interface{})
- type Assertion
- type AssignStep
- type Assignment
- type ContextKey
- type Executor
- type ExecutorRunner
- type ExecutorWithSetup
- type Failure
- type H
- type InnerResult
- type Property
- type Range
- type RangeData
- type Skipped
- type StepAssertions
- type TestCase
- type TestStep
- type TestSuite
- type Tests
- type UserExecutor
- type Venom
- func (v *Venom) AddVariables(variables map[string]interface{})
- func (v *Venom) GetExecutorRunner(ctx context.Context, ts TestStep, h H) (context.Context, ExecutorRunner, error)
- func (v *Venom) InitLogger() error
- func (v *Venom) OutputResult(tests Tests, elapsed time.Duration) error
- func (v *Venom) Parse(ctx context.Context, path []string) error
- func (v *Venom) Print(format string, a ...interface{})
- func (v *Venom) Println(format string, a ...interface{})
- func (v *Venom) PrintlnTrace(s string)
- func (v *Venom) Process(ctx context.Context, path []string) (*Tests, error)
- func (v *Venom) RegisterExecutorBuiltin(name string, e Executor)
- func (v *Venom) RegisterExecutorPlugin(name string, e Executor)
- func (v *Venom) RegisterExecutorUser(name string, e Executor)
- func (v *Venom) RunTestStep(ctx context.Context, e ExecutorRunner, tc *TestCase, stepNumber int, ...) interface{}
- func (v *Venom) RunUserExecutor(ctx context.Context, runner ExecutorRunner, tcIn *TestCase, step TestStep) (interface{}, error)
Constants ΒΆ
This section is empty.
Variables ΒΆ
var (
//Version is set with -ldflags "-X github.com/luphaz/venom/venom.Version=$(VERSION)"
Version = "snapshot"
)
Functions ΒΆ
func DumpString ΒΆ
DumpString dumps v as a map[string]string{}, key in lowercase
func DumpStringPreserveCase ΒΆ
DumpStringPreserveCase dumps v as a map[string]string{}
func GetExecutorResult ΒΆ
func GetExecutorResult(r interface{}) map[string]interface{}
func InitTestLogger ΒΆ
func JSONUnmarshal ΒΆ
func RemoveNotPrintableChar ΒΆ added in v0.16.0
RemoveNotPrintableChar removes not printable chararacter from a string
func StringSliceVarFromCtx ΒΆ
func VarFromCtx ΒΆ
Types ΒΆ
type Assertion ΒΆ
type Assertion interface{}
Assertion (usually a string, but could be a dictionary when using logical operators)
type AssignStep ΒΆ
type AssignStep struct {
Assignments map[string]Assignment `json:"vars" yaml:"vars" mapstructure:"vars"`
}
type Assignment ΒΆ
type ContextKey ΒΆ
type ContextKey string
ContextKey can be added in context to store contextual infos. Also used by logger.
type Executor ΒΆ
type Executor interface {
// Run run a Test Step
Run(context.Context, TestStep) (interface{}, error)
}
Executor execute a testStep.
type ExecutorRunner ΒΆ
type ExecutorWithSetup ΒΆ
type Failure ΒΆ
type Failure struct {
TestcaseClassname string `xml:"-" json:"-" yaml:"-"`
TestcaseName string `xml:"-" json:"-" yaml:"-"`
TestcaseLineNumber int `xml:"-" json:"-" yaml:"-"`
StepNumber int `xml:"-" json:"-" yaml:"-"`
Assertion string `xml:"-" json:"-" yaml:"-"`
AssertionRequired bool `xml:"-" json:"-" yaml:"-"`
Error error `xml:"-" json:"-" yaml:"-"`
Value string `xml:",cdata" json:"value" yaml:"value,omitempty"`
Type string `xml:"type,attr,omitempty" json:"type" yaml:"type,omitempty"`
Message string `xml:"message,attr,omitempty" json:"message" yaml:"message,omitempty"`
}
Failure contains data related to a failed test.
type H ΒΆ
type H map[string]interface{}
func AllVarsFromCtx ΒΆ
func (*H) AddAllWithPrefix ΒΆ
func (*H) AddWithPrefix ΒΆ
type InnerResult ΒΆ
type InnerResult struct {
Value string `xml:",cdata" json:"value" yaml:"value"`
}
InnerResult is used by TestCase
type Property ΒΆ
type Property struct {
XMLName xml.Name `xml:"property" json:"-" yaml:"-"`
Name string `xml:"name,attr" json:"name" yaml:"-"`
Value string `xml:"value,attr" json:"value" yaml:"-"`
}
Property represents a key/value pair used to define properties.
type RangeData ΒΆ
type RangeData struct {
Key string
Value interface{}
}
RangeData contains a single iterable user value
type Skipped ΒΆ added in v0.16.0
type Skipped struct {
Value string `xml:",cdata" json:"value" yaml:"value,omitempty"`
}
Skipped contains data related to a skipped test.
type StepAssertions ΒΆ
type StepAssertions struct {
Assertions []Assertion `json:"assertions,omitempty" yaml:"assertions,omitempty"`
}
StepAssertions contains step assertions
type TestCase ΒΆ
type TestCase struct {
XMLName xml.Name `xml:"testcase" json:"-" yaml:"-"`
Classname string `xml:"classname,attr,omitempty" json:"classname" yaml:"-"`
Errors []Failure `xml:"error,omitempty" json:"errors" yaml:"errors,omitempty"`
Failures []Failure `xml:"failure,omitempty" json:"failures" yaml:"failures,omitempty"`
Name string `xml:"name,attr" json:"name" yaml:"name"`
Skipped []Skipped `xml:"skipped,omitempty" json:"skipped" yaml:"skipped,omitempty"`
Status string `xml:"status,attr,omitempty" json:"status" yaml:"status,omitempty"`
Systemout InnerResult `xml:"system-out,omitempty" json:"systemout" yaml:"systemout,omitempty"`
Systemerr InnerResult `xml:"system-err,omitempty" json:"systemerr" yaml:"systemerr,omitempty"`
Time float64 `xml:"time,attr,omitempty" json:"time" yaml:"time,omitempty"`
RawTestSteps []json.RawMessage `xml:"-" json:"steps" yaml:"steps"`
TestSuiteVars H `xml:"-" json:"-" yaml:"-"`
Vars H `xml:"-" json:"-" yaml:"vars"`
Skip []string `xml:"-" json:"skip" yaml:"skip"`
IsExecutor bool `xml:"-" json:"-" yaml:"-"`
IsEvaluated bool `xml:"-" json:"-" yaml:"-"`
// contains filtered or unexported fields
}
TestCase is a single test case with its result.
func (*TestCase) AppendError ΒΆ
type TestStep ΒΆ
type TestStep map[string]interface{}
TestStep represents a testStep
func (TestStep) StringSliceValue ΒΆ
type TestSuite ΒΆ
type TestSuite struct {
XMLName xml.Name `xml:"testsuite" json:"-" yaml:"-"`
Disabled int `xml:"disabled,attr,omitempty" json:"disabled" yaml:""`
Errors int `xml:"errors,attr,omitempty" json:"errors" yaml:"-"`
Failures int `xml:"failures,attr,omitempty" json:"failures" yaml:"-"`
Hostname string `xml:"hostname,attr,omitempty" json:"hostname" yaml:"-"`
ID string `xml:"id,attr,omitempty" json:"id" yaml:"-"`
Name string `xml:"name,attr" json:"name" yaml:"name"`
Filename string `xml:"-" json:"-" yaml:"-"`
Package string `xml:"package,attr,omitempty" json:"package" yaml:"-"`
Properties []Property `xml:"-" json:"properties" yaml:"-"`
Skipped int `xml:"skipped,attr,omitempty" json:"skipped" yaml:"skipped,omitempty"`
Total int `xml:"tests,attr" json:"total" yaml:"total,omitempty"`
TestCases []TestCase `xml:"testcase" json:"testcases" yaml:"testcases"`
Version string `xml:"version,omitempty" json:"version" yaml:"version,omitempty"`
Time string `xml:"time,attr,omitempty" json:"time" yaml:"-"`
Timestamp string `xml:"timestamp,attr,omitempty" json:"timestamp" yaml:"-"`
Vars H `xml:"-" json:"-" yaml:"vars"`
ComputedVars H `xml:"-" json:"-" yaml:"-"`
WorkDir string `xml:"-" json:"-" yaml:"-"`
}
TestSuite is a single JUnit test suite which may contain many testcases.
type Tests ΒΆ
type Tests struct {
XMLName xml.Name `xml:"testsuites" json:"-" yaml:"-"`
Total int `xml:"-" json:"total"`
TotalOK int `xml:"-" json:"ok"` // contains the number of testcases OK
TotalKO int `xml:"-" json:"ko"` // contains the number of testcases KO
TotalSkipped int `xml:"-" json:"skipped"` // contains the number of testcases skipped
TestSuites []TestSuite `xml:"testsuite" json:"test_suites"`
}
Tests contains all informations about tests in a pipeline build
type UserExecutor ΒΆ
type UserExecutor struct {
Executor string `json:"executor" yaml:"executor"`
Input H `json:"input" yaml:"input"`
RawTestSteps []json.RawMessage `json:"steps" yaml:"steps"`
Output json.RawMessage `json:"output" yaml:"output"`
Filename string `json:"-" yaml:"-"`
}
func (UserExecutor) Run ΒΆ
func (ux UserExecutor) Run(ctx context.Context, step TestStep) (interface{}, error)
Run is not implemented on user executor
func (UserExecutor) ZeroValueResult ΒΆ
func (ux UserExecutor) ZeroValueResult() interface{}
type Venom ΒΆ added in v0.17.0
type Venom struct {
LogOutput io.Writer
PrintFunc func(format string, a ...interface{}) (n int, err error)
LibDir string
OutputFormat string
OutputDir string
StopOnFailure bool
Verbose int
// contains filtered or unexported fields
}
func (*Venom) AddVariables ΒΆ added in v0.17.0
func (*Venom) GetExecutorRunner ΒΆ
func (v *Venom) GetExecutorRunner(ctx context.Context, ts TestStep, h H) (context.Context, ExecutorRunner, error)
GetExecutorRunner initializes a test by name no type -> exec is default
func (*Venom) OutputResult ΒΆ added in v0.17.0
OutputResult output result to sdtout, files...
func (*Venom) PrintlnTrace ΒΆ
func (*Venom) RegisterExecutorBuiltin ΒΆ
RegisterExecutorBuiltin register builtin executors
func (*Venom) RegisterExecutorPlugin ΒΆ
RegisterExecutorPlugin register plugin executors
func (*Venom) RegisterExecutorUser ΒΆ
RegisterExecutorUser register User sxecutors
func (*Venom) RunTestStep ΒΆ added in v0.17.0
func (v *Venom) RunTestStep(ctx context.Context, e ExecutorRunner, tc *TestCase, stepNumber int, step TestStep) interface{}
RunTestStep executes a venom testcase is a venom context