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 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 AssignStep
- type Assignment
- type ContextKey
- type Executor
- type ExecutorRunner
- type ExecutorWithSetup
- type Failure
- type H
- type InnerResult
- type Property
- 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/ovh/venom/venom.Version=$(VERSION)"
Version = "snapshot"
)
Functions ΒΆ
func BoolVarFromCtx ΒΆ added in v1.0.0
func DumpString ΒΆ added in v1.0.0
DumpString dumps v as a map[string]string{}, key in lowercase
func DumpStringPreserveCase ΒΆ added in v1.0.0
DumpStringPreserveCase dumps v as a map[string]string{}
func GetExecutorResult ΒΆ added in v1.0.0
func GetExecutorResult(r interface{}) map[string]interface{}
func InitTestLogger ΒΆ added in v1.0.0
func RemoveNotPrintableChar ΒΆ added in v0.16.0
RemoveNotPrintableChar removes not printable chararacter from a string
func StringMapInterfaceVarFromCtx ΒΆ added in v1.0.0
func StringMapStringVarFromCtx ΒΆ added in v1.0.0
func StringSliceVarFromCtx ΒΆ added in v1.0.0
func StringVarFromCtx ΒΆ added in v1.0.0
func VarFromCtx ΒΆ added in v1.0.0
Types ΒΆ
type AssignStep ΒΆ added in v0.27.0
type AssignStep struct {
Assignments map[string]Assignment `json:"vars" yaml:"vars" mapstructure:"vars"`
}
type Assignment ΒΆ added in v0.27.0
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 ΒΆ added in v1.0.0
type ExecutorWithSetup ΒΆ added in v1.0.0
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:"-"` 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 ΒΆ added in v0.27.0
type H map[string]interface{}
func AllVarsFromCtx ΒΆ added in v1.0.0
func (*H) AddAllWithPrefix ΒΆ added in v0.27.0
func (*H) AddWithPrefix ΒΆ added in v0.27.0
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 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 []string `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 string `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:"-"` // contains filtered or unexported fields }
TestCase is a single test case with its result.
func (*TestCase) AppendError ΒΆ added in v1.0.0
type TestStep ΒΆ
type TestStep map[string]interface{}
TestStep represents a testStep
func (TestStep) StringSliceValue ΒΆ added in v1.0.0
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"` TotalKO int `xml:"-" json:"ko"` TotalSkipped int `xml:"-" json:"skipped"` TestSuites []TestSuite `xml:"testsuite" json:"test_suites"` }
Tests contains all informations about tests in a pipeline build
type UserExecutor ΒΆ added in v1.0.0
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 ΒΆ added in v1.0.0
func (ux UserExecutor) Run(ctx context.Context, step TestStep) (interface{}, error)
Run is not implemented on user executor
func (UserExecutor) ZeroValueResult ΒΆ added in v1.0.0
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 ΒΆ added in v1.0.0
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) InitLogger ΒΆ added in v1.0.0
InitLogger initializes venom logger
func (*Venom) OutputResult ΒΆ added in v0.17.0
OutputResult output result to sdtout, files...
func (*Venom) PrintlnTrace ΒΆ added in v1.0.0
func (*Venom) RegisterExecutorBuiltin ΒΆ added in v1.0.0
RegisterExecutorBuiltin register builtin executors
func (*Venom) RegisterExecutorPlugin ΒΆ added in v1.0.0
RegisterExecutorPlugin register plugin executors
func (*Venom) RegisterExecutorUser ΒΆ added in v1.0.0
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